paged.IDML Reference
Styles

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.

Tier: ProProIIIreference

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 · TableStyleValuesPagedpaged.set
BodyRegionCellStyleCellStyle referencereadtableStyleBodyRegionCellStyle
HeaderRegionCellStyleCellStyle referencereadtableStyleHeaderRegionCellStyle
FooterRegionCellStylerefreadtableStyleFooterRegionCellStyle
LeftColumnRegionCellStylerefreadtableStyleLeftColumnRegionCellStyle
RightColumnRegionCellStylerefreadtableStyleRightColumnRegionCellStyle
TopBorderStrokeColorColor / Swatch referencereadtableStyleTopBorderStrokeColor
TopBorderStrokeWeightlength (pt)readtableStyleTopBorderStrokeWeight
TopBorderStrokeTypeStrokeStyle referencenot read
StartRowFillColorColor referencereadtableStyleStartRowFillColor
StartRowFillCountnumber (count)readtableStyleStartRowFillCount
EndRowFillColorSwatch referencereadtableStyleEndRowFillColor
StrokeOrderBestJoinsnot read
Selected attributes. All 121 attributes of TableStyle →

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 StrokeOrder are 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 · CellStyleValuesPagedpaged.set
FillColorSwatch referencereadcellFillColor
FillTintintegernot read
TopEdgeStrokeColorColor / Swatch referencereadcellTopEdgeStrokeColor
TopEdgeStrokeWeightlength (pt)readcellTopEdgeStrokeWeight
TopEdgeStrokeTypereferenceread
TextTopInsetinteger / realnot read
VerticalJustificationTopAlign | CenterAlign | BottomAlign | JustifyAlignreadcellVerticalJustification
AppliedParagraphStyleParagraphStyle referencenot read
Selected attributes. All 53 attributes of CellStyle →

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, AppliedParagraphStyle, 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 %.

Supported · verified

How a cell's formatting is built

For each attribute, a cell's value comes from the first of these that sets it:

  1. the attribute on the <Cell> itself;
  2. the cell style the cell applies, through its BasedOn chain;
  3. 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.

On this page