An OpenDocument spreadsheet keeps all formatting in styles. Named (common) styles sit
in office:styles; the automatic styles that a program makes for
individual tables, columns, rows and cells sit in
office:automatic-styles. A referenced style should be defined in the same
file as the reference or in styles.xml (16.1). Table
elements point to them by name with table:style-name and
table:default-cell-style-name (see
package and tables). Section numbers
are those of OpenDocument 1.3 Part 3 (OASIS Standard, 27 April 2021). Lengths carry a
unit as in XSL (such as 2.258cm or 0.889in), colours are
#rrggbb, and angles are numbers of degrees unless followed by
deg, grad or rad (18.3).
style:style
A style (16.2) has these attributes:
| Attribute | Meaning |
|---|---|
style:name | The name by which it is referenced. |
style:display-name | Name shown to the user, when it differs. |
style:family | What it formats: table, table-column, table-row and table-cell in spreadsheets, and also paragraph, text, graphic, chart, drawing-page, presentation and ruby (19.480). |
style:parent-style-name | The style it inherits from. |
style:data-style-name | For a cell (or chart) style: the data style that formats its values. |
style:percentage-data-style-name | A data style for percentage values. |
style:class | Any class name, for grouping styles in a user interface; no meaning in the format. |
style:auto-update | true: changing the formatting of an object changes the style itself; default false, which makes a new automatic style instead. |
style:master-page-name | For a table style: the master page (page layout) to use. |
style:next-style-name, style:list-style-name, style:list-level, style:default-outline-level | Used by paragraph styles. |
Its children are the formatting-property elements for its family:
style:table-properties,
style:table-column-properties,
style:table-row-properties,
style:table-cell-properties,
style:paragraph-properties and
style:text-properties (the text in a
cell), plus graphic, chart, drawing-page, section and ruby properties for other
families, and any number of style:map conditions.
How a property’s value is found
A property is looked up in the style applied to the element, then in its parent
style, its grandparent and so on (16.2). For a table cell, if that finds nothing, the
search goes on in the style named by table:default-cell-style-name on the
cell’s row, and then in the one named by the same attribute on the cell’s column. A
paragraph inside a cell falls back to the cell’s style. After that the
default style of the family applies, then the default the
standard defines for the property, and failing that the application chooses.
style:default-style
One per family, in office:styles (16.4), with only
style:family and the same property children as a style. It holds the
defaults for every style of that family.
Conditional styles: style:map
Cell styles and data styles can hold style:map elements (16.3), each a
condition that, when true, swaps in another style. Attributes:
style:condition, style:apply-style-name (a common style of
the same kind and family; naming an automatic or missing style is an error) and
style:base-cell-address (an absolute address with sheet name, the cell
that relative references in the condition are measured from) (19.466, 19.468,
19.472). A condition may start with a namespace prefix and a colon; without one, the
OpenFormula namespace urn:oasis:names:tc:opendocument:xmlns:of:1.2
applies. An unrecognised condition makes the map be ignored.
| Condition | Used in | True when |
|---|---|---|
cell-content() op value | cell styles | The cell’s value compares true with value; op is <, >, <=, >=, = or !=. |
cell-content-is-between(v1, v2) | cell styles | The value is between the two. |
cell-content-is-not-between(v1, v2) | cell styles | The value is not between them. |
is-true-formula(expression) | cell styles | The formula evaluates true. |
value() op n | data styles | The value compares true with n, a number (or true/false in a Boolean style). |
In cell conditions a value is a decimal number, a string in double quotes (a quote
inside written twice), or an expression in the condition’s formula language.
Paragraph styles have their own conditions (footnote(),
endnote(), header(), footer(),
list-level()=n, outline-level()=n, section(),
table(), table-header()), which do not concern cells.
style:table-properties
Formatting of a whole table, that is a sheet (17.15). Child:
style:background-image.
| Attribute | Values | Meaning |
|---|---|---|
table:display | Boolean | false: the sheet is hidden (20.416). |
table:tab-color | colour | Colour of the sheet tab; absent means the default (19.731). |
style:writing-mode | lr-tb, rl-tb, tb-rl, tb-lr, lr, rl, tb, page | Writing direction, as in XSL 7.27.7; page takes it from the page (20.404). |
style:width | positive length | Fixed width of the table (20.399). |
style:rel-width | percentage | Width relative to the page (20.340). |
table:align | left, center, right, margins | Horizontal alignment; margins fills the space between the margins and may be read as left (20.414). |
table:border-model | collapsing, separating | Collapsing: the wider of two neighbouring borders is drawn, half in each cell; separating: each cell draws its own (20.415). |
fo:background-color | transparent or colour | Background (20.182). |
fo:margin, fo:margin-top, -bottom, -left, -right | length or percentage | Margins (20.205–20.209). |
fo:break-before, fo:break-after | auto, column, page | Page or column break before or after; not both (20.184, 20.185). |
fo:keep-with-next | auto, always | Keep on the same page as what follows (20.201). |
style:may-break-between-rows | Boolean | A page break may fall inside the table (20.319). |
style:page-number | number or auto | Page number for the page the table starts, when its style sets a master page (20.328). |
style:shadow | none or an XSL shadow | Shadow (20.359). |
style:table-column-properties
| Attribute | Values | Meaning |
|---|---|---|
style:column-width | positive length | Fixed column width (20.254). |
style:rel-column-width | integer followed by * | Relative width: a column of relative width rc gets rc × ws ÷ rs, where rs is the sum of the relative widths and ws the width available (20.338). |
style:use-optimal-column-width | Boolean | Recalculate the width when the column’s content changes (20.393). |
fo:break-before, fo:break-after | auto, column, page | Manual page break at the column (20.184, 20.185). |
style:table-row-properties
| Attribute | Values | Meaning |
|---|---|---|
style:row-height | positive length | Fixed row height (20.348). |
style:min-row-height | non-negative length | Minimum height (20.320). |
style:use-optimal-row-height | Boolean | Recalculate the height when the row’s content changes (20.394). |
fo:background-color | transparent or colour | Row background (20.182). |
fo:break-before, fo:break-after | auto, column, page | Manual page break at the row. |
fo:keep-together | auto, always | Do not split the row across pages (20.200). |
Child: style:background-image.
style:table-cell-properties
Formatting of cells (17.18). Child: style:background-image. The
horizontal alignment of cell text is not here but in the style’s
style:paragraph-properties (fo:text-align), used when
style:text-align-source is fix.
| Attribute | Values | Meaning |
|---|---|---|
fo:background-color | transparent or colour | Cell background; transparent also turns off a background image (20.182). |
fo:border, fo:border-top, -bottom, -left, -right | XSL border string | Borders as in XSL 7.29, such as 0.06pt solid #000000 (20.183). |
style:border-line-width, -top, -bottom, -left, -right | three lengths | For double borders: inner line width, gap, outer line width (20.248–20.252). |
style:diagonal-tl-br, style:diagonal-bl-tr | border string | Diagonal lines top left to bottom right and bottom left to top right (20.259, 20.261). |
style:diagonal-tl-br-widths, style:diagonal-bl-tr-widths | three lengths | Line widths of double diagonals (20.260, 20.262). |
fo:padding, fo:padding-top, -bottom, -left, -right | non-negative length | Space inside the borders (20.217–20.221). |
fo:wrap-option | no-wrap, wrap | Wrap text; without wrapping, whether overflow shows is up to the application (20.230). |
style:shrink-to-fit | Boolean | Reduce the font size so the content fits (20.360). |
style:vertical-align | top, middle, bottom, automatic | Vertical alignment; automatic leaves it to the application (20.396.2). |
style:text-align-source | fix, value-type | fix: use fo:text-align; value-type: align by type, text left and everything else right (20.364). |
style:repeat-content | Boolean | Repeat the text to fill the cell (no effect if the text has a line break) (20.342). |
style:rotation-angle | angle | Text rotation (20.347). |
style:rotation-align | none, bottom, top, center | none: rotated text stays inside the cell and borders are unchanged; otherwise the text may overlap other cells and the borders and background run parallel to it, the named edge staying on the cell’s edge (20.346). |
style:direction | ltr, ttb | ttb: characters stacked vertically, not rotated (20.263). |
style:writing-mode | as for tables | Writing direction (20.404.6). |
style:glyph-orientation-vertical | auto, 0, 0deg, 0rad, 0grad | Glyph orientation in vertical text; 0 turns the feature off (20.297). |
style:cell-protect | none, hidden-and-protected, or a list of protected and formula-hidden | Protection, applied only when the sheet is protected: protected no editing; formula-hidden a formula is not shown (its result is); hidden-and-protected nothing shown, no editing (20.253). |
style:print-content | Boolean | Print the cell’s content (20.331.3). |
style:decimal-places | non-negative integer | Only in a default style: decimal places for numbers whose data style does not set them (20.258). |
style:shadow | none or an XSL shadow | Shadow (20.359). |
style:text-properties
The character formatting of a cell’s text, also allowed inside data styles
(16.29.29). Its attributes are the general text properties of OpenDocument (20.x):
fo:font-family, style:font-name (a declared font face),
fo:font-size, fo:font-weight, fo:font-style,
fo:font-variant, fo:color,
fo:background-color, fo:text-transform,
fo:text-shadow, fo:letter-spacing,
fo:language, fo:country, fo:script,
fo:hyphenate and its two character counts; the
style:text-underline-…, style:text-overline-… and
style:text-line-through-… groups (type, style, width, colour, mode,
and text for line-through); style:text-position (super- and
subscript), style:text-rotation-angle and -scale,
style:text-scale, style:text-outline,
style:font-relief, style:text-emphasize,
style:text-combine with its start and end characters,
style:text-blinking, style:letter-kerning,
style:font-pitch, style:font-charset,
style:font-family-generic, style:font-style-name,
style:font-size-rel, style:script-type,
style:use-window-font-color, the RFC 5646 language tags, and
-asian and -complex variants of the font, size, weight,
style, language, country and script attributes for East Asian and complex scripts;
plus text:display and text:condition.
Data styles
A data style says how a value is shown, like a number format in other spreadsheets
(16.29). It is referenced from a cell style’s style:data-style-name.
There are seven kinds; each is a sequence of the parts below, with fixed text in
number:text between them (never two number:text in a row),
at most one number:fill-character, optional
style:text-properties and any number of style:map
conditions with value().
| Element | Values | May contain |
|---|---|---|
number:number-style | numbers | one of number:number, number:scientific-number, number:fraction |
number:currency-style | currency | number:number, number:currency-symbol |
number:percentage-style | percentages | number:number and a number:text holding % |
number:date-style | dates | number:day, month, year, era, day-of-week, week-of-year, quarter, hours, minutes, seconds, am-pm |
number:time-style | times and durations | at most one each of number:hours, minutes, seconds, am-pm |
number:boolean-style | Booleans | number:boolean (where the value goes) |
number:text-style | text | number:text-content (where the cell text goes) |
Attributes of the data style elements
| Attribute | Meaning |
|---|---|
style:name, style:display-name | Name and shown name. |
style:volatile | true: keep the style even when unused; false: it may be discarded (19.521). |
number:language, number:country, number:script, number:rfc-language-tag | The locale that decides separators, names and order; the RFC 5646 tag only when the other three cannot express it. Without them the system settings apply. |
number:title | A title. |
number:transliteration-format, -language, -country, -style | Native digits: the format is the digit one of the wanted digit set (default 1, ASCII digits); style short (default), medium or long. |
number:automatic-order | Currency and date styles: reorder the parts to suit the locale; default false. |
number:format-source | Date and time styles: fixed (default), where short and long mean what the standard says, or language, where they follow the locale. |
number:truncate-on-overflow | Time styles: true (default) shows hours modulo 24 and minutes and seconds modulo 60; false lets the largest unit grow past them, for durations. |
Number parts
| Element | Attributes |
|---|---|
number:number | number:decimal-places (absent: the default cell style’s setting); number:min-decimal-places (at most decimal-places; trailing zeros after it are dropped; absent: 0 when decimal-replacement is empty, else decimal-places); number:decimal-replacement (text shown instead of the decimals of a whole number); number:min-integer-digits; number:grouping (thousands separators, default false); number:display-factor (divide by this before showing, default 1). Child number:embedded-text: text inserted before integer digit number:position, counted from 1 leftward from the decimal separator. |
number:scientific-number | number:decimal-places, number:min-decimal-places, number:min-integer-digits, number:grouping, number:min-exponent-digits, number:exponent-interval (exponents are multiples of this, default 1), number:forced-exponent-sign (default true: always show the exponent’s sign). |
number:fraction | number:min-integer-digits (absent: no whole-number part), number:min-numerator-digits, number:min-denominator-digits, number:denominator-value (a fixed denominator), number:max-denominator-value (largest allowed denominator when none is fixed; 99 allows any of one or two digits), number:grouping. |
number:currency-symbol | Content: the symbol; empty means the locale’s symbol. number:language, number:country, number:script, number:rfc-language-tag name the currency’s locale. |
number:fill-character | Content: one character, repeated to fill the cell. |
Date and time parts
With number:format-source="fixed", number:style means
(19.362):
| Element | short | long | Other attributes |
|---|---|---|---|
number:day | 1 or 2 digits | 2 digits | number:calendar |
number:month | short name, or 1–2 digits | full name, or 2 digits | number:textual (name instead of number, default false), number:possessive-form (genitive form of the name), number:calendar |
number:year | 2 digits | 4 digits | number:calendar |
number:era | short era name | full era name | number:calendar |
number:day-of-week | short name | full name | number:calendar |
number:quarter | short name | full name | number:calendar |
number:week-of-year | – | number:calendar | |
number:hours | at least 1 digit | at least 2 | |
number:minutes | at least 1 digit | at least 2 | |
number:seconds | at least 1 digit | at least 2 | number:decimal-places (fractions of a second; default 0) |
number:am-pm | No attributes; its presence makes hours run 1 to 12. | ||
number:calendar (19.341): gregorian (switching from the
Julian calendar after 4 October 1582), gengou (Japanese imperial eras),
ROC (Minguo, Gregorian year − 1911), buddhist (Gregorian
year + 543), hanja and its old alias hanja_yoil (Korean),
hijri, jewish, or another name; absent means the locale’s
default.
Example
A hand-written pair: a date style that shows 2026-11-12 as 12/11/2026,
and a cell style using it with a bold font, a thin border and a yellow fill:
<number:date-style style:name="N37">
<number:day number:style="long"/><number:text>/</number:text>
<number:month number:style="long"/><number:text>/</number:text>
<number:year number:style="long"/>
</number:date-style>
<style:style style:name="ce1" style:family="table-cell"
style:parent-style-name="Default" style:data-style-name="N37">
<style:table-cell-properties fo:background-color="#ffff00"
fo:border="0.06pt solid #000000" style:vertical-align="middle"/>
<style:text-properties fo:font-weight="bold"/>
</style:style>
A cell <table:table-cell table:style-name="ce1"
office:value-type="date" office:date-value="2026-11-12"> then shows
12/11/2026 in bold on yellow.
Sources
- OpenDocument 1.3 Part 3: OpenDocument Schema – OASIS standard, sections 16 (styles, data styles), 17 (formatting property elements), 18.3 (data types), 19 and 20 (attributes)