Class Table
A table with relative column widths. Rows are created automatically from the added cells (honoring column and row spans). Header rows are repeated on every page; rows taller than a page are split across pages.
public sealed class Table : LayoutElement
- Inheritance
-
Table
- Inherited Members
Constructors
Table(params double[])
Creates a table with relative column widths, e.g. new Table(1, 3, 1).
public Table(params double[] relativeColumnWidths)
Parameters
relativeColumnWidthsdouble[]
Properties
AlternateRowBackground
Background for every second body row (zebra striping).
public PdfColor? AlternateRowBackground { get; set; }
Property Value
BorderColor
Default border color of the cells (default black).
public PdfColor BorderColor { get; set; }
Property Value
BorderWidth
Default border width of the cells in points (default 0.5; 0 = no borders).
public double BorderWidth { get; set; }
Property Value
CellPadding
Default inner padding of the cells in points (default 4 horizontal, 3 vertical).
public Thickness CellPadding { get; set; }
Property Value
ColumnCount
Number of columns.
public int ColumnCount { get; }
Property Value
Font
Default font for text in body cells (default Helvetica).
public PdfFont Font { get; set; }
Property Value
FontSize
Default font size in points for cell text (default 9).
public double FontSize { get; set; }
Property Value
HeaderBackground
Background of header cells (default light gray; null = none).
public PdfColor? HeaderBackground { get; set; }
Property Value
HeaderFont
Default font for text in header cells (default Helvetica-Bold).
public PdfFont HeaderFont { get; set; }
Property Value
RepeatHeader
Repeat the header rows at the top of every page the table continues on (default true).
public bool RepeatHeader { get; set; }
Property Value
SplitRowsAcrossPages
Split rows that are taller than a whole page across pages (default true). Rows that merely do not fit on the current page are moved to the next page; rows connected by row spans are kept together.
public bool SplitRowsAcrossPages { get; set; }
Property Value
WidthPercent
Table width as percentage of the available width.
public double WidthPercent { get; set; }
Property Value
Methods
AddCell(Cell)
Adds a body cell and returns it. Cells fill the rows from left to right.
public Cell AddCell(Cell cell)
Parameters
cellCell
Returns
AddCell(LayoutElement)
Adds a body cell containing element and returns it.
public Cell AddCell(LayoutElement element)
Parameters
elementLayoutElement
Returns
AddCell(string)
Adds a body cell containing text and returns it.
public Cell AddCell(string text)
Parameters
textstring
Returns
AddHeaderCell(Cell)
Adds a header cell and returns it. Leading rows that consist only of header cells form the table header.
public Cell AddHeaderCell(Cell cell)
Parameters
cellCell
Returns
AddHeaderCell(string)
Adds a header cell containing text and returns it.
public Cell AddHeaderCell(string text)
Parameters
textstring
Returns
WithColumns(int)
Creates a table with columns equally wide columns.
public static Table WithColumns(int columns)
Parameters
columnsint