ApiExamples.ExTable.AddClonedRowToTable C# (CSharp) Метод

AddClonedRowToTable() приватный Метод

private AddClonedRowToTable ( ) : void
Результат void
        public void AddClonedRowToTable()
        {
            //ExStart
            //ExFor:Row
            //ExId:AddClonedRowToTable
            //ExSummary:Shows how to make a clone of the last row of a table and append it to the 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);

            // 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);

            doc.Save(MyDir + @"\Artifacts\Table.AddCloneRowToTable.doc");
            //ExEnd

            // Verify that the row was cloned and appended properly.
            Assert.AreEqual(5, table.Rows.Count);
            Assert.AreEqual(string.Empty, table.LastRow.ToString(SaveFormat.Text).Trim());
            Assert.AreEqual(2, table.LastRow.Cells.Count);
        }