Table and cell styles
The TableStyle and CellStyle elements — how a table style nominates a default cell style per region and sets its border strokes and alternating fills, and how a cell style carries per-edge strokes and fill.
Tables get two style kinds: a cell style formats one cell, and a table style sits above it, nominating a default cell style per region and dressing the table itself.
In short: A cell style formats a single cell — its fill, its four edge strokes,
its vertical justification. A table style sits a level above it: it nominates a
default cell style for each region of the table (header, body, footer, and the
left and right columns) and carries the table's own border strokes and
alternating-row fills. <TableStyle> lives in <RootTableStyleGroup> and
<CellStyle> in <RootCellStyleGroup>; both cascade through BasedOn with the
same first-setter-wins fold as the text styles. For the table structure these
styles dress — rows, columns, header and footer regions, merged cells — see the
Tables chapter.
Tables get their own two style kinds. A cell style formats a single cell —
its fill, its four edge strokes, its insets. A table style sits a level above:
it nominates a default cell style for each region of the table (header, body,
footer, and the left / right columns) and carries the table's own border strokes
and alternating-row fills. Both cascade through BasedOn and resolve with the
same first-setter-wins fold described in the cascade.
For the table structure these styles dress — rows, columns, header/footer regions,
merged cells — see the Tables chapter.
Where they live
<TableStyle> lives in <RootTableStyleGroup> and <CellStyle> in
<RootCellStyleGroup> (each with optional intermediate group nesting the parser
flattens). A <Table> names its table style with AppliedTableStyle="…"; a
<Cell> names its cell style with AppliedCellStyle="…".
TableStyle
A table style's region attributes are references to cell styles — the cell style
to apply to cells in that region unless the cell overrides it. The border-stroke
attributes (Swatch/None normalises to unset) and the start/end alternating-fill
attributes paint the table itself.
| Attribute · TableStyle | Type / values | Support | Notes |
|---|---|---|---|
| Self | string id | Supported | The style id. What a table references via AppliedTableStyle. |
| Name | string | Parsed, not yet rendered | Human-readable name; resolution keys on Self. |
| BasedOn | string id | Supported | Parent table style, or the [No table style] default. Attribute or <BasedOn> Properties child. |
| BodyRegionCellStyle | string (CellStyle id) | Supported | Cell style for body cells (everything outside header/footer/columns). |
| HeaderRegionCellStyle | string (CellStyle id) | Supported | Cell style for header-row cells. |
| FooterRegionCellStyle | string (CellStyle id) | Supported | Cell style for footer-row cells. |
| LeftColumnRegionCellStyle / RightColumnRegionCellStyle | string (CellStyle id) | Supported | Cell styles for the leftmost / rightmost column regions. |
| TopBorderStrokeColor / BottomBorderStrokeColor / LeftBorderStrokeColor / RightBorderStrokeColor | string (swatch id) | Supported | Per-edge table-border paint. "Swatch/None" normalises to unset. |
| TopBorderStrokeWeight / … / RightBorderStrokeWeight | double (pt) | Supported | Per-edge table-border weight in points. |
| StartRowFillColor / StartRowFillCount / StartRowFillTint | swatch id / int / double | Supported | The "starting" alternating-row fill: colour, how many consecutive rows take it, and its tint. |
| EndRowFillColor / EndRowFillCount / EndRowFillTint | swatch id / int / double | Supported | The alternating "end" fill that follows the starting run. |
(crates/paged-parse/src/styles.rs defines TableStyleDef, mirrored above.)
The StrokeOrder attribute — which strokes win at a crossing (RowOnTop,
ColumnOnTop, BestJoins, Indesign2Compatibility) — and the gap-colour,
skip-alternating, and column-fill families are stored by IDML on <TableStyle>
but are not yet read here. Not yet parsedStrokeOrder, gap colours, column fills, skip-alternating counts
CellStyle
A cell style carries the fill, four per-edge strokes, and vertical justification a
cell falls back on when its own attributes are absent. Colour attributes set to
Swatch/None normalise to unset for the cascade.
| Attribute · CellStyle | Type / values | Support | Notes |
|---|---|---|---|
| Self | string id | Supported | The style id. What a cell references via AppliedCellStyle, and what a TableStyle region attribute points at. |
| Name | string | Parsed, not yet rendered | Human-readable name; resolution keys on Self. |
| BasedOn | string id | Supported | Parent cell style, or the [None] default. Attribute or <BasedOn> Properties child. |
| FillColor | string (swatch id) | Supported | Cell background fill. "Swatch/None" normalises to unset. |
| VerticalJustification | string (e.g. TopAlign, CenterAlign, BottomAlign) | Supported | Vertical placement of the cell's content. |
| TopEdgeStrokeColor / BottomEdgeStrokeColor / LeftEdgeStrokeColor / RightEdgeStrokeColor | string (swatch id) | Supported | Per-edge cell-border paint. "Swatch/None" normalises to unset. |
| TopEdgeStrokeWeight / … / RightEdgeStrokeWeight | double (pt) | Supported | Per-edge cell-border weight in points. |
(crates/paged-parse/src/styles.rs defines CellStyleDef, mirrored above.)
The cell insets (TopInset, LeftInset, BottomInset, RightInset), the
AppliedParagraphStyle the cell's text starts from, diagonal lines, and gap
colours are stored by IDML on <CellStyle> but are not yet read here — cell
padding today comes from the cell element rather than its style.
How a cell's effective formatting is built — its own attributes, then its cell style's chain, then the table style's region default — follows the same layered logic as text; see conflict resolution.
Frequently asked questions
What is the difference between a table style and a cell style? A cell style formats a single cell — its fill, four edge strokes, and vertical justification. A table style sits above it: it nominates a default cell style for each region of the table and carries the table's own border strokes and alternating-row fills.
How does a table style apply formatting to different parts of a table?
Its region attributes — BodyRegionCellStyle, HeaderRegionCellStyle,
FooterRegionCellStyle, and the left and right column region attributes — are
references to cell styles, naming the cell style to apply to cells in that region
unless a cell overrides it.
How do a table and a cell reference their styles?
A <Table> names its table style with AppliedTableStyle and a <Cell> names its
cell style with AppliedCellStyle; each value is the style's Self id.
Are there table or cell style attributes the parser does not yet read?
Yes. On <TableStyle>, StrokeOrder, gap colours, column fills, and
skip-alternating counts are stored but not yet read; on <CellStyle>, the cell
insets, AppliedParagraphStyle, diagonal lines, and gap colours are not yet read —
cell padding today comes from the cell element rather than its style.
Object styles
The ObjectStyle element — the page-item analogue of paragraph and character styles — its fill, stroke, and corner attributes, the RootObjectStyleGroup, and the [None] default that every frame in the reference packages applies.
Conflict resolution
How the parser computes a run's effective formatting — local range override, then the applied character style's BasedOn chain, then the applied paragraph style's chain — the ambiguous cases, and the style constructs that are parsed but not yet enforced.