public void BuildSimpleTable()
{
//ExStart
//ExFor:DocumentBuilder
//ExFor:DocumentBuilder.Write
//ExFor:DocumentBuilder.InsertCell
//ExId:BuildSimpleTable
//ExSummary:Shows how to create a simple table using DocumentBuilder with default formatting.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// We call this method to start building the table.
builder.StartTable();
builder.InsertCell();
builder.Write("Row 1, Cell 1 Content.");
// Build the second cell
builder.InsertCell();
builder.Write("Row 1, Cell 2 Content.");
// Call the following method to end the row and start a new row.
builder.EndRow();
// Build the first cell of the second row.
builder.InsertCell();
builder.Write("Row 2, Cell 1 Content");
// Build the second cell.
builder.InsertCell();
builder.Write("Row 2, Cell 2 Content.");
builder.EndRow();
// Signal that we have finished building the table.
builder.EndTable();
// Save the document to disk.
doc.Save(MyDir + @"\Artifacts\DocumentBuilder.CreateSimpleTable.doc");
//ExEnd
// Verify that the cell count of the table is four.
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
Assert.IsNotNull(table);
Assert.AreEqual(table.GetChildNodes(NodeType.Cell, true).Count, 4);
}