public void CloneTable()
{
//ExStart
//ExId:CloneTable
//ExSummary:Shows how to make a clone of a table in the document and insert it after the original table.
Document doc = new Document(MyDir + "Table.SimpleTable.doc");
// Retrieve the first table in the document.
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
// Create a clone of the table.
Table tableClone = (Table)table.Clone(true);
// Insert the cloned table into the document after the original
table.ParentNode.InsertAfter(tableClone, table);
// Insert an empty paragraph between the two tables or else they will be combined into one
// upon save. This has to do with document validation.
table.ParentNode.InsertAfter(new Paragraph(doc), table);
doc.Save(MyDir + @"\Artifacts\Table.CloneTableAndInsert.doc");
//ExEnd
// Verify that the table was cloned and inserted properly.
Assert.AreEqual(2, doc.GetChildNodes(NodeType.Table, true).Count);
Assert.AreEqual(table.Range.Text, tableClone.Range.Text);
//ExStart
//ExId:CloneTableRemoveContent
//ExSummary:Shows how to remove all content from the cells of a cloned table.
foreach (Cell cell in tableClone.GetChildNodes(NodeType.Cell, true))
cell.RemoveAllChildren();
//ExEnd
Assert.AreEqual(String.Empty, tableClone.ToString(SaveFormat.Text).Trim());
}