我在一个列表框中有一个项目列表,我试图将其动态插入到word文档中的表中,word中的表只有一行,但如果列表框中有多个项,则需要它添加更多项。
我目前正在像这样将这些项添加到表中("Item Description"是我在word中设置的自定义属性):
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 ));我已经做了我的研究,但到目前为止我什么都找不到
希望有人能指引我走向正确的方向
谢谢你提前帮忙。
发布于 2020-01-15 14:17:39
最后我自己想出来了。
我将这些项目插入表中如下:
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;
}https://stackoverflow.com/questions/59752050
复制相似问题