TableBuilder
Overview
TableBuilder is a class in Aspose.PDF FOSS for TypeScript.
A page-independent table: ordered rows over shared text defaults.
This class declares 8 methods for TableBuilder objects in TypeScript programs.
Available methods include: addRow, autoFitColumns, constructor, continuationFrom, measure, resolveColumnWidths, setColumnWidths, setRepeatingRowsCount.
All public members are accessible to any TypeScript application after installing the Aspose.PDF FOSS for TypeScript package.
Properties: cellPadding, max, min, repeatingRowCount, rows.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
rows | : RowBuilder[] | Read | Gets the rows. |
max | : number[] | Read | Gets the max. |
min | : number[] | Read | Gets the min. |
repeatingRowCount | number | Read | Gets the repeating row count. |
cellPadding | : number | Read | Gets the cell padding. |
cellPadding | : number | Read | Gets the cell padding. |
Methods
| Signature | Description |
|---|---|
constructor(defaults: TableDefaults) | @internal Use {@link createTable}. |
addRow(cells: (string | TextRun[])[], opts: RowOptions) → RowBuilder | Append a row with an optional row-level style and minHeight. |
setColumnWidths(widths: ColumnWidth[]) → this | Set per-column widths as fixed points or fractions of the leftover space. |
autoFitColumns() → this | Size columns from their content rather than splitting the width equally: proportional to each column’s widest unwrapped line, floored at its widest single word, falling back to equal shares when even the floors do not fit. |
setRepeatingRowsCount(n: number) → this | Repeat the first n rows at the top of every continuation page (n = 0 disables). |
continuationFrom(startRow: number) → TableBuilder | @internal Build a continuation table of the rows left after startRow: shares this table’s defaults and normalized column specs, carries the original column count, and holds the same RowBuilder references (never mutated). |
resolveColumnWidths(totalWidth: number, opts: { cellPadding?: number }) → number[] | Resolve the column specs (from {@link setColumnWidths}, or equal columns if unset) plus a totalWidth in points into concrete per-column widths. |
measure(columnWidths: number[], opts: { cellPadding?: number }) → TableMetrics | Measure the table’s natural laid-out height given resolved columnWidths (points). |