Styles
The styles object holds named style definitions, and a node takes one by naming it in its "style" key. A style is a
block of the keys CSS and SVG would write for the same thing, so formatting is stated once and every node that names it
agrees.
{
"document": {
"styles": {
"h1": { "fontSize": 22, "fontWeight": "bold", "color": "#1A1A2E" },
"body": { "fontSize": 10, "color": "#333333", "textAlign": "justify" }
},
"content": [
{ "h1": "Main Heading" },
{ "p": "Body paragraph text." }
]
}
}
This page says how a style is declared and applied, and lists every key with the page that documents it: Box model, Typography, Colour and paint, Borders and Structural selectors, and the content pages for the keys that belong to one kind of node (Lists, Tables, Breaks, Columns, Images).
Declaring and applying a style
| Where | What it does |
|---|---|
document.styles | Each entry is a name and a block of style keys: "callout": { "padding": 8, "backgroundColor": "#f3f4f6" }. |
a node's style | The named style the node is drawn in: a paragraph, a heading, a cell, a list, a table, a columns node, an image, a rule, an svg and its shapes, a table of contents, a watermark. |
a node with only a style, first in a column or a cell | Styles that column or that cell: { "style": "card" } gives the column its box. |
[span, name]...[/span] inside text | Draws the run in the named style's inline box: its text keys (color, fontFamily, fontSize, fontWeight, fontStyle, letterSpacing and the font-feature keys) and its box (padding, background, border, radius, clip path). A fontWeight or fontStyle it states is the run's own, so normal sets a run upright or regular inside a bold or italic paragraph. Keys an inline box does not take are named once in a NOTICE; see Shortcodes. |
Inline tags such as [b], [i] and [color] override the node's style for the span they enclose.
Keys apply in the order they are written, as the declarations of one CSS rule do, so a later key wins where two
overlap: "padding": 6, "paddingLeft": 24 gives 24 on the left and 6 elsewhere, while "paddingLeft": 24, "padding": 6
gives 6 all round. The same holds for border and borderTop, or border and borderColor.
A style the document does not declare is drawn as the engine's default style, with a WARNING naming it. When a
component brings styles with it, a style of the same name in the document replaces the
component's whole.
Built-in style names
A node that names no style is drawn in a built-in one. Declare a style of the same name and it replaces the built-in one for every node of that kind.
| Name | Drawn on | Without a declaration |
|---|---|---|
body | every paragraph and list that names no style | the built-in sans at 10pt, black |
cell | every td that names no style | the built-in sans at 10pt, black |
cellHeader | every th that names no style | the built-in sans at 10pt, black |
table | every table that names no style | collapsed borders, a 0.5pt black grid |
tocTitle | the title of a table of contents | |
footnote | the text of a [note] at the page foot | body's keys at three quarters of its size |
h1 ... h6 | every heading of that level that names no style | HTML's scale against the body's size: 2, 1.5, 1.17, 1, 0.83 and 0.67 em, bold, with HTML's margins above and below |
A declared h2 replaces the built-in h2 whole: { "h2": { "color": "#0F2A4A" } } draws level-two headings at the
default 10pt, not bold. State the size and weight with the colour.
Styles only carry visual concerns. Structural attributes that change a node's footprint in its parent, such as a
table cell's colspan and rowspan or a heading's outline toggle, live on the node itself, as colspan="2" is an
attribute of an HTML <td> and not a CSS rule.
What a style hands down
A style does not cascade from body: body is the style of nodes that name none, not a parent of the others. A
paragraph in style note takes only what note says, so a style restates the family and size it needs.
What does pass down is what CSS inherits (CSS 2.1 6.2). Inside a container - a columns node, a table, a list, the box
around a list or a table, an svg group - the text takes the container style's inherited keys (the font keys, color,
lineHeight, textAlign and the other text keys) wherever its own style leaves them unset. A box key such as
padding, border or backgroundColor stays on the container.
{
"styles": {
"panel": { "fontSize": 9, "color": "#1e3a5f", "backgroundColor": "#eef2f7", "padding": 8 },
"aside": { "fontStyle": "italic" }
},
"content": [
{ "columns": { "style": "panel", "rows": [
[ { "p": "Navy, 9pt: the panel's text keys." } ],
[ { "p": "Navy, 9pt and italic: its own key over the panel's.", "style": "aside" } ]
] } }
]
}
A table's style reaches its cells the same way, a list's style its items' text, and the style of a columns node every block in its columns.
A style beside a list or a table
A list or a table can carry two styles. The one inside the payload is the list's or the table's own: its markers or its grid, its text, its structural selectors. The one beside it, on the node that holds the payload, is the box around it: its margins, padding, border and background, and the text keys it hands in.
{
"styles": {
"inBrief": { "backgroundColor": "#fdf3e3", "padding": 10, "borderLeft": "3pt solid #b45309", "color": "#7a3e00" },
"steps": { "listStyleType": "upperRoman" }
},
"content": [
{ "ol": { "style": "steps", "li": [ { "p": "Moor on the starboard side." }, { "p": "Double the stern line." } ] },
"style": "inBrief" }
]
}
A key that is the payload's own and not inherited, written beside it (start beside a list, tableLayout beside a
table), reaches nothing there, and a NOTICE says to write it in the list's or the table's own style.
How style validation works
Styles are held to the published schema at both layers, so what the editor accepts is exactly what renders:
| Layer | Behavior |
|---|---|
| Editor / IDE (via the JSON schema) | Unknown style keys get a red squiggle. The schema enumerates every valid property name and value; typos like fontWieght or colour are flagged on the line you type them. |
| API (before rendering) | The same schema is applied before anything is rendered or billed. An unknown key, a misspelt value, or a key or value in another case (FontWeight, "CENTER") is refused with a 400 naming the path and the allowed values. |
Keys and values are case-sensitive: fontWeight and "center" are the only spellings. A well-formed key that cannot
act where it is placed (a table key on a paragraph, say) is not refused; the render report names it. Each module page
lists the placements its keys cannot act on.
Naming follows CSS and SVG
Property names mirror the CSS and SVG specifications, so anyone fluent in HTML and CSS writes DocPayload styles by ear. The translation is mechanical:
- Keys: CSS kebab-case becomes JSON camelCase.
font-sizebecomesfontSize,margin-topbecomesmarginTop,border-collapsebecomesborderCollapse,text-alignbecomestextAlign. - Values: lower case, as CSS writes them:
textAlign: "center",borderCollapse: "collapse",verticalAlign: "middle",strokeLinecap: "round",fontWeight: "bold". - Values are camelCase where CSS hyphenates them:
lineThrough,nonScalingStroke,textBeforeEdge,noRepeat,borderBox,selfStart. - Shape properties follow SVG's presentation attributes:
fill,stroke,strokeWidth,strokeDasharray,strokeLinecap,strokeLinejoin. See Colour and paint. - Lengths are a number of points, or a string with a unit
pt,in,mmorpx:12,"12pt","4mm","0.5in". - Borders use CSS's shorthand string,
"1pt solid #9ca3af", its parts in any order. See Borders.
Every style key
The schema's 144 style keys, grouped as the engine's style catalogue groups them. "Takes" is what the key accepts, a length being a number of points or a string with a unit; the page named is where the key is documented in full.
Typography
| Key | Takes | Default | What it does | Page |
|---|---|---|---|---|
direction | ltr, rtl | ltr | Base writing direction of the text | Typography |
writingMode | horizontalTb, verticalRl, verticalLr | horizontalTb | Lines across the page or down it | Typography |
textOrientation | mixed, upright, sideways | mixed | How characters stand in a vertical line | Typography |
textCombineUpright | none, all, digits2, digits3, digits4 | none | Digits set side by side in one em, vertical lines only | Typography |
fontFamily | a declared or built-in family | The family the text is set in | Typography | |
fontSize | length, up to 1638pt | Size of the text | Typography | |
fontStyle | normal, italic, oblique | normal | Italic or upright face | Typography |
fontWeight | normal, bold, bolder, lighter, 100-900, or 1 to 1000 | normal | Weight of the text | Typography |
letterSpacing | length, negative allowed | Extra space after every character | Typography | |
lineHeight | a multiplier, a length, a percentage, an em, normal | normal | Distance between baselines | Typography |
defaultTabStop | length above 0 | 36 | Interval of the automatic tab stops | Typography |
tabStops | an array of lengths or stop objects | The paragraph's own tab stops | Typography | |
textAlign | start, end, left, center, right, justify | start | How lines sit across the block | Typography |
textAlignLast | auto, start, end, left, center, right, justify | auto | How the last line sits | Typography |
textJustify | auto, none, interWord, interCharacter | auto | How a justified line is stretched | Typography |
textDecoration | none, underline, lineThrough, or both | Lines drawn with the text | Typography | |
textIndent | length, negative allowed | 0 | Indent of the first line | Typography |
horizontalScaling | a whole percentage | 100 | Stretches or compresses the glyphs across | Typography |
textRise | length, negative allowed | 0 | Shifts the baseline of every run | Typography |
hyphens | none, manual, auto | manual | Where a word may break | Typography |
hyphenateLimitChars | one to three of auto or a whole number: "6 3 2" | auto | The shortest word hyphens: auto divides, and the letters kept each side of its hyphen | Typography |
hyphenateLimitLines | a whole number, 0 or more | no limit | The most lines in a row ending on a hyphen | Typography |
hyphenateCharacter | auto, one character, or "" | auto | What a divided word draws at the break | Typography |
hangingPunctuation | none, or in this order one space apart: first, forceEnd or allowEnd, last | none | Punctuation set outside the line | Typography |
lineSnap | none, baseline, contain | none | Lines shifted down onto the line grid | Typography |
textSpacingTrim | normal, spaceAll, spaceFirst, trimStart, trimBoth, trimAll | normal | Half-width CJK punctuation at line ends | Typography |
whiteSpace | normal, nowrap | normal | Whether the text wraps | Typography |
wordSpacing | length, negative allowed | Extra space at every word space | Typography | |
fontKerning | auto, normal, none | auto | Whether the font's kerning is applied | Typography |
fontSynthesis | none, or weight, style, smallCaps, position in any order | weight style smallCaps position | Whether a missing bold, italic, small capitals or superscripts are made | Typography |
fontVariantCaps | normal, smallCaps, allSmallCaps, petiteCaps, allPetiteCaps, unicase, titlingCaps | normal | The face's small, petite or titling capitals | Typography |
fontVariantPosition | normal, sub, super | normal | The face's own superscript or subscript glyphs | Typography |
fontVariantAlternates | normal, or historicalForms, stylistic(name), styleset(name, ...), characterVariant(name, ...), swash(name), ornaments(name), annotation(name) | normal | Alternate glyphs by the names the family declares | Typography |
fontVariantEastAsian | normal, or in this order one space apart: one of jis78, jis83, jis90, jis04, simplified, traditional; one of fullWidth, proportionalWidth; ruby | normal | East Asian glyph forms and widths | Typography |
fontVariantNumeric | normal, or in this order: liningNums/oldstyleNums, proportionalNums/tabularNums, diagonalFractions/stackedFractions, ordinal, slashedZero | normal | Which figures are drawn | Typography |
fontVariantLigatures | normal, none, or in this order one space apart: commonLigatures or noCommonLigatures, discretionaryLigatures or noDiscretionaryLigatures, historicalLigatures or noHistoricalLigatures, contextual or noContextual | normal | Which ligatures are joined | Typography |
fontFeatureSettings | normal, or quoted OpenType tags: "'ss01', 'tnum' off" | normal | Any OpenType feature by its tag, applied last | Typography |
dominantBaseline | auto, alphabetic, ideographic, middle, central, mathematical, hanging, textTop, textBottom, textBeforeEdge, textAfterEdge | Which part of svg text sits on its y | Typography | |
alignmentBaseline | auto, baseline, beforeEdge, textBeforeEdge, middle, central, afterEdge, textAfterEdge, ideographic, alphabetic, hanging, mathematical | SVG's alignment-baseline, read when dominantBaseline is absent | Typography | |
strokeLinecap | butt, round, square | butt | Shape of line ends | Colour and paint |
strokeLinejoin | miter, round, bevel | miter | Shape of corners | Colour and paint |
textRenderingMode | fill, stroke, fillstroke, invisible, fillclip, strokeclip, fillstrokeclip, clip | fill | How text is painted: filled, stroked, invisible, clipping | Typography |
overflowWrap | normal, breakWord, anywhere | normal | Whether a word too long for its line is split | Typography |
Box
| Key | Takes | Default | What it does | Page |
|---|---|---|---|---|
collapsingMargins | true, false | Top margin collapses into the margin above | Box model | |
columnGap | length | Space between columns | Columns | |
columnWidth | length | Width of each flowed column | Columns | |
height | length | Height of the box (least and most) | Box model | |
justifySelf | start, center, end, left, right, auto, normal, stretch, selfStart, selfEnd, flexStart, flexEnd | auto | Where a narrower block sits across its container | Box model |
marginBottom | length, negative allowed | Space outside the box, below | Box model | |
marginLeft | length, negative allowed | 0 | Space outside the box, left | Box model |
marginRight | length, negative allowed | 0 | Space outside the box, right | Box model |
marginTop | length, negative allowed | 0 | Space outside the box, above | Box model |
maxHeight | length | The most height the box takes | Box model | |
maxWidth | length | The most width the box takes | Box model | |
minHeight | length | The least height the box takes | Box model | |
minWidth | length | The least width the box takes | Box model | |
clipPath | circle(), ellipse(), inset(), polygon(), path(), none | none | Clips the box and its content to a shape | Colour and paint |
padding | one to four lengths | 0 | Space inside the box, every side | Box model |
paddingBottom | length | 0 | Space inside the box, below | Box model |
paddingLeft | length | 0 | Space inside the box, left | Box model |
paddingRight | length | 0 | Space inside the box, right | Box model |
paddingTop | length | 0 | Space inside the box, above | Box model |
verticalAlign | top, middle, bottom, baseline | baseline | Where a cell's content sits in its box | Box model |
width | length | Width of the box (least and most) | Box model | |
alignContent | normal, start, center, end | normal | Where content sits down a box taller than it | Box model |
alignItems | normal, stretch, start, end, center, baseline, firstBaseline, selfStart, selfEnd, flexStart, flexEnd | normal | Where each column sits in its row | Box model |
justifyContent | normal, start, end, center, left, right, spaceBetween, spaceAround, spaceEvenly, stretch, flexStart, flexEnd | normal | Where the columns stand when fixed widths leave room | Columns |
alignSelf | auto, normal, stretch, start, end, center, baseline, firstBaseline, selfStart, selfEnd, flexStart, flexEnd | auto | One column's own placement in its row | Box model |
clear | none, left, right, both | none | Which floats the block stands below | Box model |
columnCount | a whole number | How many columns the content flows across | Columns | |
columnFill | balance, auto | balance | Whether a flow's columns are balanced or filled in turn | Columns |
lineGrid | matchParent, create | matchParent | The grid a block's lines snap to | Typography |
boxDecorationBreak | slice, clone | slice | Whether a box a page or a line breaks is cut at the break or closed on each piece | Breaks |
columnSpan | none, all | none | Whether a block in a column flow spans every column | Columns |
float | none, left, right | none | Takes the block out of the flow to an edge | Box model |
margin | one to four lengths, negative allowed | Space outside the box, every side | Box model | |
overflowX | visible, hidden, clip, scroll, auto | visible | Content past the box across: drawn or cut | Box model |
overflowY | visible, hidden, clip, scroll, auto | visible | Content past the box downward: drawn or cut | Box model |
strokeWidth | length | 1 | Width of a shape's outline or a line | Colour and paint |
boxSizing | contentBox, borderBox | contentBox | What width and height measure | Box model |
objectFit | fill, contain, cover, none, scaleDown | fill | How an image fills its box | Images |
Borders
| Key | Takes | Default | What it does | Page |
|---|---|---|---|---|
outline | "width style colour" | A frame outside the border box, taking no space | Borders | |
outlineOffset | length, negative allowed | 0 | Distance of the outline from the border box | Borders |
columnRule | "width style colour" | A rule in each gap between flowed columns | Borders | |
border | "width style colour" | Every side's border | Borders | |
borderBottom | "width style colour" | The bottom border | Borders | |
borderBottomLeftRadius | length | 0 | Rounds the bottom-left corner | Borders |
borderBottomRightRadius | length | 0 | Rounds the bottom-right corner | Borders |
borderCollapse | separate, collapse | Shared cell borders or separate ones | Borders | |
borderColor | a colour | Colour of every side's border | Borders | |
borderLeft | "width style colour" | The left border | Borders | |
borderRadius | length | Rounds every corner | Borders | |
borderRight | "width style colour" | The right border | Borders | |
borderStyle | none, solid, dashed, dotted, double, roundDots, groove, inset, outset, ridge, dashedFixed | Line style of every side's border | Borders | |
borderTop | "width style colour" | The top border | Borders | |
borderTopLeftRadius | length | 0 | Rounds the top-left corner | Borders |
borderTopRightRadius | length | 0 | Rounds the top-right corner | Borders |
borderWidth | length | Width of every side's border | Borders |
Paint
| Key | Takes | Default | What it does | Page |
|---|---|---|---|---|
background | a colour | Shorthand: only a colour is read | Colour and paint | |
backgroundColor | a colour | transparent | Colour behind the box | Colour and paint |
color | a colour | Colour of the text | Colour and paint | |
opacity | 0 to 1 | 1 | Transparency of the element | Colour and paint |
backgroundImage | url(name.png) or none | none | An image behind the box | Colour and paint |
backgroundSize | cover, contain, or a width and height | auto | How large the background image is drawn | Colour and paint |
backgroundPosition | keywords, lengths or percentages | 0% 0% | Where the background image's first copy stands | Colour and paint |
backgroundRepeat | repeatX, repeatY, or one or two of repeat, space, round, noRepeat (across, then down) | repeat | How the background image tiles | Colour and paint |
dropShadow | an object: dx, dy, blur, color, opacity | A shadow cast behind a shape | Colour and paint | |
fill | a colour, none, or a gradient | black | Interior of a shape | Colour and paint |
fillOpacity | 0 to 1 | 1 | Transparency of the fill alone | Colour and paint |
stroke | a colour or none | none | Colour of a shape's outline or a line | Colour and paint |
strokeDasharray | on and off lengths, up to 64 | Dash pattern | Colour and paint | |
strokeDashoffset | length, negative allowed | 0 | Starting offset into the dash pattern | Colour and paint |
strokeMiterlimit | a number, 1 or more | 4 | How far a mitred corner may reach | Colour and paint |
strokeOpacity | 0 to 1 | 1 | Transparency of the stroke alone | Colour and paint |
Lists
| Key | Takes | Default | What it does | Page |
|---|---|---|---|---|
start | a whole number, 0 and negative too | 1 | The number the first item carries | Lists |
listStylePosition | outside, inside | outside | Marker hangs before the text or starts it | Lists |
marker | a block of style keys | Styles the markers apart from the item text | List markers, below | |
listStyleType | a counter style, none, or any text | The list's marker | Lists | |
symbolAlign | start, end | start | Which end the markers line up on | Lists |
symbolIndent | length, negative allowed | Space before the marker | Lists | |
prefix | text | "" | Text before each marker's number | Lists |
suffix | text | Text after each marker's number | Lists |
Tables
| Key | Takes | Default | What it does | Page |
|---|---|---|---|---|
borderSpacing | a length, or [across, down] | Space between separate cells | Borders | |
repeatHeader | true, false | Header rows repeat on every page | Tables | |
tableLayout | fixed, auto | Declared widths kept, or sized to content | Tables | |
captionSide | top, bottom | top | Caption above or below | Tables |
Breaks
| Key | Takes | Default | What it does | Page |
|---|---|---|---|---|
breakAfter | auto, avoid, always, page, column, left, right, recto, verso | auto | A page or column break after the block | Breaks |
breakBefore | auto, avoid, always, page, column, left, right, recto, verso | auto | A page or column break before the block | Breaks |
breakInside | auto, avoid, avoidPage | auto | Whether the block may break across pages | Breaks |
orphans | a whole number, 1 or more | 2 | Fewest lines left at the foot of a page | Breaks |
widows | a whole number, 1 or more | 2 | Fewest lines carried to the next page | Breaks |
Transforms and positioning
| Key | Takes | Default | What it does | Page |
|---|---|---|---|---|
bottom | length, negative allowed | Offset from the bottom; the page's bottom edge under fixed | Box model | |
left | length, negative allowed | Offset from the left; the page's left edge under fixed | Box model | |
right | length, negative allowed | Offset from the right; the page's right edge under fixed | Box model | |
position | static, relative, fixed | static | In the flow, shifted from it, or at page coordinates | Box model |
pageNumber | a whole number | The page a fixed block is drawn on | Box model | |
top | length, negative allowed | Offset from the top; the page's top edge under fixed | Box model | |
transformOrigin | keywords, percentages or lengths | 50% 50% | The point rotate turns about | Transforms, below |
rotate | degrees, positive clockwise | Turns the block | Transforms, below | |
transform | a CSS transform list | none | Translates, scales, skews, turns or applies a matrix | Transforms, below |
Structural selectors
| Key | Takes | Default | What it does | Page |
|---|---|---|---|---|
nthChild | An+B index to a block of style keys | Styles children by position from the first | Structural selectors | |
nthLastChild | An+B index to a block of style keys | Styles children by position from the last | Structural selectors | |
firstChild | a block of style keys | Styles the first child | Structural selectors | |
lastChild | a block of style keys | Styles the last child | Structural selectors |
Other
| Key | Takes | Default | What it does | Page |
|---|---|---|---|---|
vectorEffect | nonScalingStroke, none | none | Keeps a stroke's width in a scaled symbol | Colour and paint |
Transforms — rotation, skew, affine
Transformation primitives, for vertical sidebars, stamped overlays, edge-mounted barcodes and angled banners. A transform moves what the block draws and leaves its place in the flow alone, as in CSS.
| Property | Takes | Description |
|---|---|---|
rotate | degrees | Rotation, positive clockwise, about transformOrigin. |
transformOrigin | keywords, percentages or lengths | The point rotate turns about, as CSS's transform-origin: "left top", "100% 50%", "10pt 0". Default "50% 50%", the centre. |
transform | a CSS transform list | matrix(), translate(), scale(), rotate(), skewX(), skewY() and skew(), such as "skewX(20deg)"; angles carry their unit, and a bare number is points, or the svg's own units in an svg. |
Neither a turn nor a transform is carried across a page break; the render report says so. In a DOCX a rotated paragraph
is a turned text box, in a table cell too; a transform matrix, and a rotated block other than a paragraph, are
reported, as is a rotated paragraph that floats, is shifted by position, holds more than text (an image, a barcode, a
field), or is written under a Strict claim: it stands upright.
Example — angled rubber-stamp overlay
{
"styles": {
"stamp": {
"fontSize": 28,
"fontWeight": "bold",
"color": "#7A1F2A",
"letterSpacing": 4,
"rotate": -15,
"opacity": 0.55,
"textAlign": "center"
}
},
"content": [
{ "p": "AWAITING PAYMENT", "style": "stamp" }
]
}
Example — vertical sidebar text
{
"styles": {
"sidebar": {
"fontSize": 14,
"fontWeight": "bold",
"color": "#1B5E3F",
"letterSpacing": 8,
"rotate": 90
}
},
"content": [
{ "p": "DOCUMENT OFFICIEL", "style": "sidebar" }
]
}
For lines that run down the page rather than a turned block, see writingMode in Typography.
List markers: marker
CSS Lists 3 gives every list item a ::marker pseudo-element. Here it is the marker block inside the list's
style: a block of the keys a marker takes, so the number or bullet is styled apart from the item's text, which
keeps the list's own keys. The list's other keys are on Lists.
| Key | Takes | What it does |
|---|---|---|
color, fontFamily, fontSize, fontWeight, fontStyle, letterSpacing, horizontalScaling | as the style keys of the same name | the marker's text: the "inheritable properties that apply to text" CSS Lists 3 3.1.1 lets reach a marker. |
width, height, padding, backgroundColor, border, borderRadius | as the style keys of the same name | a box drawn behind the marker, centred on the item's first line, with the marker centred in it. A 14 x 14 box with borderRadius 7 is a disc. |
clipPath | circle(), ellipse(), inset() or polygon() (CSS Masking 1, CSS Shapes 1), lengths in points or percentages of the box; none | clips the box and the marker to a shape: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%) is a diamond. |
{
"styles": {
"steps": {
"listStyleType": "decimal", "suffix": "",
"marker": { "color": "#ffffff", "fontWeight": "bold", "backgroundColor": "#3b4a2f", "width": 14, "height": 14, "borderRadius": 7 }
},
"alternating": {
"listStyleType": "upperRoman",
"marker": { "fontWeight": "bold" },
"nthChild": { "even": { "marker": { "color": "#b91c1c" } } }
}
},
"content": [
{ "ol": { "style": "steps", "li": [ { "p": "Survey" }, { "p": "Design" }, { "p": "Build" } ] } },
{ "ol": { "style": "alternating", "li": [ { "p": "Survey" }, { "p": "Design" }, { "p": "Build" } ] } }
]
}
A key a marker does not take (marginLeft, textAlign) is refused where it is written. A position rule's
marker block lays over the list's key by key, as the second style shows. The DOCX puts the text keys, the
border and the shading on Word's own numbering, keeps that numbering in every case, and the render report names
the box keys a numbering level cannot carry (width, height, padding, radius, clip path): Word then draws the
marker as a shaded square hugging the number.
Worked examples
Layered heading hierarchy h1–h5
{
"styles": {
"h1": {
"fontSize": 18, "fontWeight": "bold", "color": "#FFFFFF", "letterSpacing": 2,
"backgroundColor": "#0F2A4A",
"paddingTop": 10, "paddingRight": 14, "paddingBottom": 10, "paddingLeft": 14,
"marginTop": 18, "marginBottom": 8
},
"h2": {
"fontSize": 12, "fontWeight": "bold", "color": "#0F2A4A", "letterSpacing": 1,
"borderBottom": "1pt solid #0F2A4A",
"paddingBottom": 4,
"marginTop": 14, "marginBottom": 6
},
"h3": { "fontSize": 10.5, "fontWeight": "bold", "color": "#C66B1B", "marginTop": 10, "marginBottom": 3 },
"h4": { "fontSize": 9.5, "fontWeight": "bold", "fontStyle": "italic", "color": "#1A1A2E" },
"h5": { "fontSize": 8.5, "fontWeight": "bold", "color": "#666666", "letterSpacing": 2 }
}
}
Tier-coded data badges
For per-row variation in a data-driven table, put the inline highlight and colour in the bound data. This is the
document's .data.json, not the definition; a table with "source": "$data.tiers" and "map": ["name", "badge"]
draws each badge as written. For banding by row number instead, see Structural selectors.
{
"tiers": [
{ "name": "Public", "badge": "[hl, #E8F4EC][color, #1E6F3A][b] PUBLIC [/b][/color][/hl]" },
{ "name": "Restricted", "badge": "[hl, #FCEEF0][color, #7A1F2A][b] RESTRICTED [/b][/color][/hl]" }
]
}
Encrypted-document banner with stroked text
{
"styles": {
"banner": {
"fontSize": 36,
"fontWeight": "bold",
"color": "#7A1F2A",
"letterSpacing": 6,
"textRenderingMode": "stroke",
"strokeWidth": 0.5,
"textAlign": "center",
"opacity": 0.3
}
}
}
See Shortcodes for the inline-formatting tag reference and Page Setup for page-level styling (borders, backgrounds, margins).