Styles
IDML keeps formatting in named, reusable style sheets, and the parser resolves a style reference plus its chain of parents into the values a run actually renders with.
A style in IDML is a named bundle of formatting that text, frames, and tables point at instead of repeating values inline.
In short: A finished page carries thousands of formatting decisions — every
paragraph's font, size, indent, and spacing; every run's colour and tracking;
every frame's fill and stroke. IDML records each of those bundles once, in
Resources/Styles.xml, and lets stories, frames, and tables reference a style
by id rather than spelling out the values on every span of text. A style is rarely
self-contained: it inherits from a parent through BasedOn and can be overridden
locally on the range that applies it, so the value a glyph finally renders with is
the result of a small resolution the parser performs. This chapter explains what
lives in the style sheet and the two mechanics — the cascade and local overrides —
that every style kind shares.
A finished page carries thousands of formatting decisions — every paragraph's
font, size, indent, and spacing; every run's colour and tracking; every frame's
fill and stroke. IDML does not repeat those decisions on each piece of text.
Instead it names them once, in Resources/Styles.xml, and lets stories, frames,
and tables point at a style by id. A run says AppliedCharacterStyle="…"; the
values live in the style sheet.
That indirection is what this chapter is about. A style is rarely self-contained:
it inherits from a parent through BasedOn, and the text that applies it can
override a single attribute right on the range. So the value a glyph finally
renders with is the result of a small resolution — applied style, parent chain,
and local override, folded together in a fixed order. Read this chapter once the
stories and frames that carry these
styles already make sense; styles are the layer that paints them.
What lives in the style sheet
Resources/Styles.xml is one part referenced from the design map by its
idPkg:Styles entry. Inside, each kind of style sits in its own root group:
- Paragraph styles —
<ParagraphStyle>in<RootParagraphStyleGroup>. Font, size, alignment, indents, spacing, and the character defaults a paragraph starts from. - Character styles —
<CharacterStyle>in<RootCharacterStyleGroup>. Run-level overrides: font style, size, fill, tracking, and the like. - Object styles —
<ObjectStyle>in<RootObjectStyleGroup>. Fill, stroke, and corner defaults a frame inherits. - Table and cell styles —
<TableStyle>and<CellStyle>. Region cell styles, borders, fills, and insets for tables.
The two ideas to carry through
Every style kind shares the same two mechanics, and the chapter spends most of its time on them:
- The cascade —
BasedOnlinks a style to a parent. The parser walks that chain at resolve time, filling any attribute the child left unset from the parent above it, all the way down to the root. - Local overrides — an attribute set directly on a
<ParagraphStyleRange>or<CharacterStyleRange>wins over whatever the applied style would supply.
The last page, conflict resolution, puts both together: it traces, attribute by attribute, exactly how the parser computes a single run's effective formatting, and calls out the ambiguous cases and the constructs it parses but does not yet act on.
Frequently asked questions
What is a style in IDML?
A style is a named, reusable bundle of formatting stored in
Resources/Styles.xml. Instead of repeating values like font, size, and colour
on every piece of text, IDML defines them once and lets stories, frames, and
tables reference the style by id.
What kinds of styles does IDML have? IDML has five style kinds, each in its own root group: paragraph styles, character styles, object styles, and table and cell styles. Paragraph and character styles format text; object styles format page items; table and cell styles dress tables.
How does the parser decide what value a piece of text actually renders with?
It folds together three sources in a fixed order: a value set directly on the
range wins first, then the applied style resolved through its
BasedOn chain, then the root defaults at the bottom
of that chain. The full attribute-by-attribute walk is covered in
conflict resolution.
Why ranges, not spans
Why IDML models styled text as nested paragraph and character ranges rather than the inline spans of HTML, and what that means for walking the tree.
The cascade
BasedOn links a style to a parent; the parser folds that chain into one resolved set of values, bounds cycles with a depth cap, and lets a local override on a range still win.