Table and cell styles
The TableStyle and CellStyle elements — how a table style assigns a cell style to each region and dresses the table, and what a cell style carries.
A cell style formats one cell; a table style sits above it, choosing a cell style for each region of the table and drawing the table's borders, dividers and alternating fills.
In short <CellStyle> carries a cell's fill, its four edge strokes, its insets, vertical
justification, rotation, diagonal lines and the paragraph style its text starts in.
<TableStyle> names the cell style for each region (header rows, body rows, footer rows, the
left and right columns) and carries the table's outer border, its row and column dividers and
its alternating fills. A <Table> applies a table style with AppliedTableStyle, a <Cell>
applies a cell style with AppliedCellStyle, and both style kinds inherit through BasedOn.
For the table structure itself, see the tables chapter.
Where they live
Table styles sit under <RootTableStyleGroup> and cell styles under <RootCellStyleGroup>, both
in Resources/Styles.xml. The built-ins are TableStyle/$ID/[No table style],
TableStyle/$ID/[Basic Table] and CellStyle/$ID/[None]. As on every cascading style, InDesign
writes BasedOn as a typed <Properties> child.
TableStyle
| Attribute · TableStyle | Values | Paged | paged.set |
|---|---|---|---|
| BodyRegionCellStyle | CellStyle reference | read | tableStyleBodyRegionCellStyle |
| HeaderRegionCellStyle | CellStyle reference | read | tableStyleHeaderRegionCellStyle |
| FooterRegionCellStyle | ref | read | tableStyleFooterRegionCellStyle |
| LeftColumnRegionCellStyle | ref | read | tableStyleLeftColumnRegionCellStyle |
| RightColumnRegionCellStyle | ref | read | tableStyleRightColumnRegionCellStyle |
| TopBorderStrokeColor | Color / Swatch reference | read | tableStyleTopBorderStrokeColor |
| TopBorderStrokeWeight | length (pt) | read | tableStyleTopBorderStrokeWeight |
| TopBorderStrokeType | StrokeStyle reference | not read | |
| StartRowFillColor | Color reference | read | tableStyleStartRowFillColor |
| StartRowFillCount | number (count) | read | tableStyleStartRowFillCount |
| EndRowFillColor | Swatch reference | read | tableStyleEndRowFillColor |
| StrokeOrder | BestJoins | not read |
The region attributes are references to cell styles. A cell that does not apply a cell style of
its own takes the one for its region. The border family has one set per edge (Top…,
Bottom…, Left…, Right…), each with colour, weight, type, tint and gap colour. The
alternating fills come in a start and an end phase, for rows (StartRowFill…,
EndRowFill…) and for columns (StartColumnFill…, EndColumnFill…), with
SkipFirstAlternatingFillRows and its siblings to leave the first or last rows out. The divider
family (StartRowStroke…, EndRowStroke…, StartColumnStroke…, EndColumnStroke…) works the
same way for the lines between rows and columns. StrokeOrder decides which line is on top
where a row divider crosses a column divider.
In Paged: the region cell styles, the outer border's colours and weights, the alternating row and column fills and their skip counts resolve from a table style. The divider family and
StrokeOrderare not read from the table style; the table's own divider attributes are, and row dividers paint over column dividers at a crossing. Supported · verified
CellStyle
| Attribute · CellStyle | Values | Paged | paged.set |
|---|---|---|---|
| FillColor | Swatch reference | read | cellFillColor |
| FillTint | integer | not read | |
| TopEdgeStrokeColor | Color / Swatch reference | read | cellTopEdgeStrokeColor |
| TopEdgeStrokeWeight | length (pt) | read | cellTopEdgeStrokeWeight |
| TopEdgeStrokeType | reference | read | |
| TextTopInset | integer / real | not read | |
| VerticalJustification | TopAlign | CenterAlign | BottomAlign | JustifyAlign | read | cellVerticalJustification |
| AppliedParagraphStyle | ParagraphStyle reference | not read |
The edge family has one set per edge, as on the table style. The text insets
(TextTopInset, TextLeftInset, TextBottomInset, TextRightInset) pad the cell's text from
its edges.
AppliedParagraphStyle gives the paragraph style for text typed into a cell that applies the
style.
In Paged: a cell style's fill colour, edge colours, weights and stroke types, vertical justification and rotation resolve as the fallback for a cell that does not set them. Its fill tint, insets,
Supported · verifiedAppliedParagraphStyle, diagonal lines and gap colours are not read; a cell's padding comes from the cell's own inset attributes. A cell's fill tint is not modelled at all, on the cell or on its style, so a tinted cell fill shows at 100 %.
How a cell's formatting is built
For each attribute, a cell's value comes from the first of these that sets it:
- the attribute on the
<Cell>itself; - the cell style the cell applies, through its
BasedOnchain; - the cell style the table style assigns to the cell's region.
The table's border and dividers are drawn from the <Table> element's own attributes first, then
from its table style.
Frequently asked questions
What is the difference between a table style and a cell style? A cell style formats a single cell: fill, edges, insets, alignment. A table style chooses a cell style for each region of the table and draws the table's own border, dividers and alternating fills.
How does a table style format different parts of a table?
Through its region attributes: HeaderRegionCellStyle, BodyRegionCellStyle,
FooterRegionCellStyle, LeftColumnRegionCellStyle and RightColumnRegionCellStyle each name the
cell style for that part.
How do a table and a cell reference their styles?
A <Table> uses AppliedTableStyle and a <Cell> uses AppliedCellStyle, each set to the
style's Self id.
What does StrokeOrder do?
It decides which line is drawn on top where a row divider and a column divider cross.
Object styles
The ObjectStyle element — the page-item analogue of a text style — its fill, stroke and corner attributes, its Enable switches, and the built-in [None] style.
Conflict resolution
The order in which a run's own attributes, its character style and its paragraph style combine, what Swatch/None means there, and the cases that need care.