0

我开发了一个 WinForms 应用程序,它利用 DocX 库来编辑内存中的 .docx 文件

我有几个带有数据的样本。我想在单独的页面中打印每个样本。

我使用这样的代码在一个表中插入三个表。

Table t6 = document.AddTable(1, 3);
t6.Rows[0].Cells[0].InsertTable(table2).InsertParagraphAfterSelf("");
t6.Rows[0].Cells[1].InsertTable(table4).InsertParagraphAfterSelf("");
t6.Rows[0].Cells[2].InsertTable(table5).InsertParagraphAfterSelf("");
document.InsertTable(t6);

第一个样品没问题,但从下一个样品我得到第一个样品和第二个样品。与第三个相同.....我将在下一个中获取所有以前的样本。

如何在下一个示例中删除上一个示例。我曾尝试使用 table remove 和 clear 但没有奏效。

  t6.Rows[0].Cells[0].Tables.First().Remove();
  t6.Rows[0].Cells[0].Pictures.First().Remove();

有什么建议么?

4

0 回答 0