首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >word Xceed中的动态单元

word Xceed中的动态单元
EN

Stack Overflow用户
提问于 2020-01-15 13:03:40
回答 1查看 490关注 0票数 0

我在一个列表框中有一个项目列表,我试图将其动态插入到word文档中的表中,word中的表只有一行,但如果列表框中有多个项,则需要它添加更多项。

我目前正在像这样将这些项添加到表中("Item Description"是我在word中设置的自定义属性):

代码语言:javascript
复制
            template.AddCustomProperty(new Xceed.Document.NET.CustomProperty("Item Description", item.ProdName));
            template.AddCustomProperty(new Xceed.Document.NET.CustomProperty("Quantity", item.Quantity));
            template.AddCustomProperty(new Xceed.Document.NET.CustomProperty("Unit Price", item.Price));
            template.AddCustomProperty(new Xceed.Document.NET.CustomProperty("Total Per Item", Total ));

我已经做了我的研究,但到目前为止我什么都找不到

希望有人能指引我走向正确的方向

谢谢你提前帮忙。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-01-15 14:17:39

最后我自己想出来了。

我将这些项目插入表中如下:

代码语言:javascript
复制
            foreach (listItem item in descriptionclb.Items)
            {
                ItemTable.Rows[i].Cells[j].Paragraphs[0].Append(item.ProdName);
                j++;
                ItemTable.Rows[i].Cells[j].Paragraphs[0].Append(item.ProdName);
                j++;
                ItemTable.Rows[i].Cells[j].Paragraphs[0].Append(item.Quantity.ToString());
                j++;
                ItemTable.Rows[i].Cells[j].Paragraphs[0].Append(item.Price.ToString());
                j++;
                ItemTable.Rows[i].Cells[j].Paragraphs[0].Append(Total.ToString());

                i++;
                j = 0;
            }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59752050

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档