We're sorry Aspose doesn't work properply without JavaScript enabled.

# Modifying a table

The documentation concerning tables says that to "start a table’, you simply call InsertCell(). But what do I do if I want to insert rows and cells in the middle of an existing table?

Hi
Thanks for your inquiry. You can try using the following code to insert new row into the existing table

// Open document
Document doc = new Document(@"Test149\in.doc");
// Get table from the document
Table tab = doc.FirstSection.Body.Tables[0];
// Create new row or clone existing row
Row newRow = (Row)tab.FirstRow.Clone(true);
// Insert new row into the table
// Use AppendChield method if you need to insert row at the end of table
tab.Rows.Insert(2, newRow);
// save output document
doc.Save(@"Test149\out.doc");