2

有没有办法将具有预定义样式、字体、内容控制等的表格从一个页面克隆到另一个页面,以便我可以在不同的故事中填写不同的数据。因此,例如,我将有一张表格,在一张表格中显示一个人的姓名、年龄、地址。然后下一页具有相同的表格样式但信息不同。

这可能吗?我找到了一种克隆行/列但不是整个表的方法。

我将 C# 与 OpenXML SDK 2.0 一起使用。对此主题的任何帮助将不胜感激。

感谢期待。

问候

4

1 回答 1

0

这篇文章可能会有所帮助

foreach (var order in customerOrderHistory)
    {
        TableRow rowCopy = (TableRow)theRow.CloneNode(true);
        rowCopy.Descendants<TableCell>().ElementAt(0).Append(new Paragraph 
            (new Run (new Text(order.Contact.ToString()))));
        rowCopy.Descendants<TableCell>().ElementAt(1).Append(new Paragraph 
            (new Run (new Text(order.NameOfProduct.ToString()))));
        rowCopy.Descendants<TableCell>().ElementAt(2).Append(new Paragraph 
            (new Run (new Text(order.Amount.ToString()))));
        theTable.AppendChild(rowCopy);
     }
于 2011-07-20T00:22:04.343 回答