private static void CloneLastRow(string dataDir)
{
// ExStart:CloneLastRow
Document doc = new Document(dataDir + "Table.SimpleTable.doc");
// Retrieve the first table in the document.
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
// Clone the last row in the table.
Row clonedRow = (Row)table.LastRow.Clone(true);
// Remove all content from the cloned row's cells. This makes the row ready for
// New content to be inserted into.
foreach (Cell cell in clonedRow.Cells)
cell.RemoveAllChildren();
// Add the row to the end of the table.
table.AppendChild(clonedRow);
dataDir = dataDir + "Table.AddCloneRowToTable_out.doc";
// Save the document to disk.
doc.Save(dataDir);
// ExEnd:CloneLastRow
Console.WriteLine("\nTable last row cloned successfully.\nFile saved at " + dataDir);
}
}