Cell formatting is used during building of a table. It is represented by a CellFormat object returned by the DocumentBuilder.CellFormat property. CellFormat encapsulates various table cell properties like width or vertical alignment.
Example DocumentBuilderSetCellFormatting
Shows how to create a table that contains a single formatted cell.
[C#]
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.StartTable();
builder.InsertCell();
// Set the cell formatting
CellFormat cellFormat = builder.CellFormat;
cellFormat.Width = 250;
cellFormat.LeftPadding = 30;
cellFormat.RightPadding = 30;
cellFormat.TopPadding = 30;
cellFormat.BottomPadding = 30;
builder.Writeln("I'm a wonderful formatted cell.");
builder.EndRow();
builder.EndTable();
[Visual Basic]
Dim doc As Document = New Document()
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
builder.StartTable()
builder.InsertCell()
' Set the cell formatting
Dim cellFormat As CellFormat = builder.CellFormat
cellFormat.Width = 250
cellFormat.LeftPadding = 30
cellFormat.RightPadding = 30
cellFormat.TopPadding = 30
cellFormat.BottomPadding = 30
builder.Writeln("I'm a wonderful formatted cell.")
builder.EndRow()
builder.EndTable()
[Java]
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.startTable();
builder.insertCell();
// Set the cell formatting
CellFormat cellFormat = builder.getCellFormat();
cellFormat.setWidth(250);
cellFormat.setLeftPadding(30);
cellFormat.setRightPadding(30);
cellFormat.setTopPadding(30);
cellFormat.setBottomPadding(30);
builder.writeln("I'm a wonderful formatted cell.");
builder.endRow();
builder.endTable();