PdfFlowTableBuilder Class

Builds a table of a flow document: its columns, its header rows (repeated on each page the table continues on) and its rows. A row and the rows its cells span stay on one page.

public sealed class PdfFlowTableBuilder

Properties

NameDescription
BorderColorGets or sets the color of the borders. The default is gray.
BorderWidthGets or sets the width of the borders of the cells, in points; 0 for none. The default is 0.5.
CellPaddingGets or sets the space between the borders and the content of the cells, in points. The default is 4.
HeaderBackgroundGets or sets the background of the header rows, or null for none. The default is light gray.

Gets or sets the color of the borders. The default is gray.

public PdfColor BorderColor { get; set; }

Property value

PdfColor

Gets or sets the width of the borders of the cells, in points; 0 for none. The default is 0.5.

public double BorderWidth { get; set; }

Property value

double

Exceptions

ArgumentOutOfRangeException
The value is negative.

Gets or sets the space between the borders and the content of the cells, in points. The default is 4.

public double CellPadding { get; set; }

Property value

double

Exceptions

ArgumentOutOfRangeException
The value is negative.

HeaderBackground

PdfFlowTableBuilder.cs

Gets or sets the background of the header rows, or null for none. The default is light gray.

public PdfColor? HeaderBackground { get; set; }

Property value

PdfColor?

Methods

NameDescription
Columns(ReadOnlySpan<double>)Sets the relative widths of the columns: the width of the table is divided in proportion. Without it, the columns of the first row have equal widths.
HeaderRow(Action<PdfFlowRowBuilder>)Adds a header row: its cells are header cells (TH) of their columns.
HeaderRow(IEnumerable<string>)Adds a header row of texts: its cells are header cells (TH) of their columns.
Row(Action<PdfFlowRowBuilder>)Adds a row.
Row(IEnumerable<string>)Adds a row of texts.

Columns(ReadOnlySpan<double>)

PdfFlowTableBuilder.cs

Sets the relative widths of the columns: the width of the table is divided in proportion. Without it, the columns of the first row have equal widths.

public PdfFlowTableBuilder Columns(params scoped ReadOnlySpan<double> weights)

Parameters

weights ReadOnlySpan<double>
The weights, one per column.

Returns

PdfFlowTableBuilder The builder.

Exceptions

ArgumentException
A weight is not positive, or there is none.

HeaderRow overloads

HeaderRow(Action<PdfFlowRowBuilder>)

PdfFlowTableBuilder.cs

Adds a header row: its cells are header cells (TH) of their columns.

Parameters
build Action<PdfFlowRowBuilder>
The function that adds the cells.
Returns

PdfFlowTableBuilder The builder.

Exceptions
InvalidOperationException
A row that is not a header row was added before.

HeaderRow(IEnumerable<string>)

PdfFlowTableBuilder.cs

Adds a header row of texts: its cells are header cells (TH) of their columns.

public PdfFlowTableBuilder HeaderRow(params IEnumerable<string> cells)
Parameters
cells IEnumerable<string>
The texts of the cells.
Returns

PdfFlowTableBuilder The builder.

Row overloads

Row(Action<PdfFlowRowBuilder>)

PdfFlowTableBuilder.cs

Adds a row.

Parameters
build Action<PdfFlowRowBuilder>
The function that adds the cells.
Returns

PdfFlowTableBuilder The builder.

Row(IEnumerable<string>)

PdfFlowTableBuilder.cs

Adds a row of texts.

public PdfFlowTableBuilder Row(params IEnumerable<string> cells)
Parameters
cells IEnumerable<string>
The texts of the cells.
Returns

PdfFlowTableBuilder The builder.