The table model
The Table element — the row and column counts that define the grid, the table style, header and footer rows, the outer border and the dividers.
The <Table> element declares a table's grid with counts and carries the table's own border and dividers as attributes.
In short A <Table> defines its grid with HeaderRowCount, BodyRowCount,
FooterRowCount and ColumnCount, and its <Row>, <Column> and <Cell> children fill the
grid in. The table can apply a table style (AppliedTableStyle) and set its own outer border,
one set of attributes per edge, and alternating row and column dividers. Every stroke has a
colour, weight, tint and stroke type, and patterned strokes have a gap colour.
A table with one header row and two body rows in two columns. The counts on the <Table> set
the grid; the outer border is set on the table itself.
The grid
The table has HeaderRowCount + BodyRowCount + FooterRowCount rows and ColumnCount columns,
and lists one <Row> per row and one <Column> per column. The counts also assign rows to
regions: the first HeaderRowCount rows are the header, the last FooterRowCount the footer,
the rest the body. A region decides which cell style a table style gives a cell, and header and
footer rows repeat when the table breaks across frames.
| Attribute · Table | Values | Paged | paged.set |
|---|---|---|---|
| HeaderRowCount | integer | read · written | |
| BodyRowCount | integer | read · written | |
| FooterRowCount | integer | read · written | |
| ColumnCount | integer | read · written | |
| AppliedTableStyle | TableStyle reference | read · written | appliedTableStyle |
| TableDirection | LeftToRightDirection | written | |
| SpaceBefore | real | not read | |
| SpaceAfter | real | not read |
TableDirection sets whether column 0 is on the left (LeftToRightDirection) or the right
(RightToLeftDirection). SpaceBefore and SpaceAfter add space between the table and the text
above and below it.
In Paged: the counts, the rows, columns and cells, and the table style (its region cell styles, border and alternating fills) are applied.
TableDirection,SpaceBeforeandSpaceAfterare not read yet. Supported · verified
Header and footer rows
Header rows repeat at the top of each frame a table continues into, and footer rows at the bottom
of each frame but the last, so every part of a long table carries its column heads.
BreakHeaders and BreakFooters choose how often: in every text column, once per frame or once
per page. SkipFirstHeader leaves the header out of the first part and SkipLastFooter the
footer out of the last.
In Paged: header and footer rows repeat once per frame.
Supported · verifiedBreakHeaders,BreakFooters,SkipFirstHeaderandSkipLastFooterare not read yet. Paged also readsRepeatingHeaderandRepeatingFooterset tofalseto stop the repeat; InDesign does not write these.
The outer border
The four edges of the table each have their own stroke, set on the <Table> and taking
precedence over the table style:
Attributes, per edge (Top…, Bottom…, Left…, Right…) | Meaning |
|---|---|
…BorderStrokeColor | the stroke's swatch; Swatch/None for no stroke |
…BorderStrokeWeight | the weight in points |
…BorderStrokeTint | the tint, a percentage |
…BorderStrokeType | the stroke style, such as StrokeStyle/$ID/Solid, StrokeStyle/$ID/ThickThick (a double line) or StrokeStyle/$ID/Dashed |
…BorderStrokeGapColor, …BorderStrokeGapTint | the colour between the dashes, dots or lines of a patterned stroke |
Row and column dividers
The lines between rows and between columns alternate in two phases. StartRowStrokeCount rows
take the start stroke, then EndRowStrokeCount rows the end stroke, and the pattern repeats down
the table; columns work the same way across.
| Attributes | Meaning |
|---|---|
StartRowStrokeCount, EndRowStrokeCount | how many dividers each phase covers |
StartRowStrokeColor / …Weight / …Tint / …Type / …GapColor, and the EndRow… set | the row-divider strokes of each phase |
StartColumnStroke…, EndColumnStroke… | the same for column dividers |
SkipFirstAlternatingStrokeRows, SkipLastAlternatingStrokeRows (and …Columns) | rows or columns left out of the alternation at the start or end |
When a table style's dividers apply, InDesign also writes the resulting stroke onto each cell's
matching edge, so ordinary grid lines are often carried by the cells. Where a row divider crosses
a column divider, the table style's StrokeOrder decides which is on top.
In Paged: the outer border, the row and column dividers and the cell edges are drawn in their stroke style: solid, a double line (
Supported · verifiedThickThick) as two rules, and the dotted styles as dots. Other named styles, such asDashed, are drawn solid, and gap colours are read but not painted. Row dividers are drawn over column dividers at crossings;StrokeOrderis not read.
Frequently asked questions
How does a <Table> define how many rows and columns it has?
With HeaderRowCount, BodyRowCount and FooterRowCount, which add up to the number of rows,
and ColumnCount. It then lists one <Row> per row and one <Column> per column.
What does a table style give a table?
A cell style for each region (header, body, footer, left and right column), the outer border,
the dividers and the alternating fills. Anything set on the <Table> itself wins.
Why do grid lines appear when the table's divider attributes are at their defaults? Because InDesign writes the dividers a table style produces onto each cell's edges too, and the cell edge strokes draw the grid.
How is a double or dashed border written?
With the edge's stroke type: TopBorderStrokeType="StrokeStyle/$ID/ThickThick" for a double line,
StrokeStyle/$ID/Dashed for dashes, and TopBorderStrokeGapColor for the colour between them.
Tables
An IDML table is a grid that rides on a paragraph — a Table element with rows, columns and cells holding their own text, drawn where the story reaches it.
Rows, columns, and cells
The Row, Column and Cell children of a table — track sizes, AutoGrow and KeepWithNextRow, the column:row address, merged cells, insets, fills and strokes.