Live table geometry
Fit the current table
Place the caret inside a table, then resize it against the usable width of its current document section.
Current tableWaiting for the editor
Move into a table
Available-
Table width-
Page used-
Columns-
Table proportions will appear here.
Sizing presets
Each preset uses the page and table geometry at the current input position.
Custom target
Combine a target width with the distribution that fits the content.
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Table width is calculated from document geometry
For a top-level table, the available width is the current section's page width minus its left and right margins. For a nested table, the containing parent cell is the hard width limit. A sizing strategy turns that width into a target, then applies it directly to the table's columns.
Current table
TXTextControl.tables.getItem
Page geometry
Selection.sectionFormat.pageSize / pageMargins
Nested table context
Table.getOuterTable / TableCell.getStart / TableCell.getLength
Column geometry
TableColumn.getWidth / setWidth
How the algorithms differ
The demo calls Table.getNestedLevel first. At level 1 it uses the section width. At deeper levels it gets the immediate outer table, then finds the parent cell whose character range contains the nested table's first position. No selection or input-position change is required.
Fit proportionally applies one scale factor to the existing column widths. The table reaches the usable page width without losing its visual hierarchy.
Minimize inspects the longest text value in each column and creates a compact width estimate, while retaining a practical minimum width. Maximize fills the page with equal columns.
The custom target can preserve the current ratios, distribute the width equally, or weight the columns by their content. Widths are applied once per column, following the proportional approach described in the Auto-Sizing Tables Proportionally article.