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

NameTypeAccessDescription
rows: RowBuilder[]ReadGets the rows.
max: number[]ReadGets the max.
min: number[]ReadGets the min.
repeatingRowCountnumberReadGets the repeating row count.
cellPadding: numberReadGets the cell padding.
cellPadding: numberReadGets the cell padding.

Methods

SignatureDescription
constructor(defaults: TableDefaults)@internal Use {@link createTable}.
addRow(cells: (string | TextRun[])[], opts: RowOptions)RowBuilderAppend a row with an optional row-level style and minHeight.
setColumnWidths(widths: ColumnWidth[])thisSet per-column widths as fixed points or fractions of the leftover space.
autoFitColumns()thisSize 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)thisRepeat 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 })TableMetricsMeasure the table’s natural laid-out height given resolved columnWidths (points).