Inserting row to existing table


#1

Hi,



I want to add new rows with cells in it to an existing table from an
existing word document. How can I do that? What do I have to consider?



Thanks!


#2

Hi,

Thank you for considering Aspose.Word.

When you need to change an existing document object, it is more reasonable to deal directly with the object model instead of involving DocumentBuilder though it is certainly less convenient. Therefore you should obtan the Table object and add preliminarily created rows to it, something like this:

Table table = doc.Sections[0].Body.Tables[0];

table.Rows.Add(row1);

table.Rows.Add(row2);

...