[英]How to Add New Row in an Existing Table Using Novacode DocX
我的Word文檔中有一個僅包含標題的現有表。 我想以編程方式在該表上添加數據。 我想在其中添加行,但是找不到如何:
我嘗試了以下方法:
Table myTable = document.Tables[0];
Row myRow = new Row();
myTable.Rows.Add(myRow);
myTable.Rows[0].Cells[0].Paragraphs.First().Append("Sample Data");
myTable.Rows[0].Cells[1].Paragraphs.First().Append("Sample Data");
生成后返回錯誤: The type 'Novacode.Row' has no constructors defined
Row myRow = myTable.InsertRow();
myRow.Cells[0].Paragraphs.First().Append("Sample Data");
myRow.Cells[1].Paragraphs.First().Append("Sample Data");
myTable.Rows.Add(myRow);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.