public void InsertTable()
{
//ExStart
//ExFor:DocumentBuilder
//ExFor:DocumentBuilder.StartTable
//ExFor:DocumentBuilder.InsertCell
//ExFor:DocumentBuilder.EndRow
//ExFor:DocumentBuilder.EndTable
//ExFor:DocumentBuilder.CellFormat
//ExFor:DocumentBuilder.RowFormat
//ExFor:CellFormat
//ExFor:CellFormat.Width
//ExFor:CellFormat.VerticalAlignment
//ExFor:CellFormat.Shading
//ExFor.CellFormat.Orientation
//ExFor:RowFormat
//ExFor:RowFormat.HeightRule
//ExFor:RowFormat.Height
//ExFor:RowFormat.Borders
//ExFor:Shading.BackgroundPatternColor
//ExFor:Shading.ClearFormatting
//ExSummary:Shows how to build a nice bordered table.
DocumentBuilder builder = new DocumentBuilder();
// Start building a table.
builder.StartTable();
// Set the appropriate paragraph, cell, and row formatting. The formatting properties are preserved
// until they are explicitly modified so there's no need to set them for each row or cell.
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.CellFormat.Width = 300;
builder.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;
builder.CellFormat.Shading.BackgroundPatternColor = Color.GreenYellow;
builder.RowFormat.HeightRule = HeightRule.Exactly;
builder.RowFormat.Height = 50;
builder.RowFormat.Borders.LineStyle = LineStyle.Engrave3D;
builder.RowFormat.Borders.Color = Color.Orange;
builder.InsertCell();
builder.Write("Row 1, Col 1");
builder.InsertCell();
builder.Write("Row 1, Col 2");
builder.EndRow();
// Remove the shading (clear background).
builder.CellFormat.Shading.ClearFormatting();
builder.InsertCell();
builder.Write("Row 2, Col 1");
builder.InsertCell();
builder.Write("Row 2, Col 2");
builder.EndRow();
builder.InsertCell();
// Make the row height bigger so that a vertically oriented text could fit into cells.
builder.RowFormat.Height = 150;
builder.CellFormat.Orientation = TextOrientation.Upward;
builder.Write("Row 3, Col 1");
builder.InsertCell();
builder.CellFormat.Orientation = TextOrientation.Downward;
builder.Write("Row 3, Col 2");
builder.EndRow();
builder.EndTable();
builder.Document.Save(MyDir + @"\Artifacts\DocumentBuilder.InsertTable.doc");
//ExEnd
}