ODF has one table model for every kind of document: a table on a slide is the same
table:table as a word processing table or a spreadsheet sheet. A table is
a grid stored row by row; columns are described once, at the top, and each row holds
its cells in order. This page covers sections 9.1 and 16.20 to 16.22 of OpenDocument
1.3 part 3 and the attributes those elements take (chapter 19). How a table looks
(widths, borders, backgrounds) is set by styles, described on the
table formatting page.
Where a table sits on a slide
A slide holds its shapes directly in draw:page, and a
table:table is not a shape. It is one of the content elements of a
draw:frame (section 10.4.2): the frame gives it a position and size
(svg:x, svg:y, svg:width,
svg:height) and a graphic style (draw:style-name). A frame
may hold several representations of the same content, the first being the one the
author prefers, so a table frame may also carry, for instance, a
draw:image to fall back on. A frame can stand in a draw:page,
a style:master-page, a presentation:notes page, a
style:handout-master, a draw:g group, a text box, or
another table’s cell.
A frame that is a table placeholder from a presentation page layout has
presentation:class="table"; the other values (title,
outline, subtitle, text, graphic,
object, chart, orgchart, page,
notes, handout and, on master pages only,
header, footer, date-time,
page-number) are described on the
shapes page. Presentation
tables are standard object shapes. Inside a frame the table’s own
table:title and table:desc are not used; the frame’s
svg:title and svg:desc are.
<draw:frame draw:style-name="gr1" presentation:class="table"
svg:x="2cm" svg:y="4cm" svg:width="12cm" svg:height="3cm">
<table:table table:name="Table1" table:style-name="Table1">
<table:table-column table:number-columns-repeated="2"/>
<table:table-row>
<table:table-cell office:value-type="string"><text:p>Quarter</text:p></table:table-cell>
<table:table-cell office:value-type="string"><text:p>Sales</text:p></table:table-cell>
</table:table-row>
</table:table>
</draw:frame>
Table elements
The children of a table:table come in this order: optional title and
description, optional link source, scenario, forms, shapes and named expressions,
then the columns, then the rows.
| Element | Meaning | Attributes | Children |
|---|---|---|---|
table:table | A table. | table:name, table:style-name, table:template-name, the six table:use-…-styles switches, table:is-sub-table, table:print, table:print-ranges, table:protected, table:protection-key, table:protection-key-digest-algorithm, xml:id | table:title, table:desc, table:table-source, table:scenario, office:forms, table:shapes, table:named-expressions, office:dde-source, column elements, row elements, text:soft-page-break |
table:title | The table’s title, as text. Not used inside a draw:frame. | – | text |
table:desc | A description for accessibility, as text. Not used inside a draw:frame. | – | text |
table:table-column | One or more adjacent columns with the same properties. | table:style-name, table:default-cell-style-name, table:number-columns-repeated, table:visibility, xml:id | none |
table:table-columns | A run of columns; means the same as if the start and end tags were not there. | – | table:table-column |
table:table-header-columns | Header columns: repeated on every page when the table is too wide for one. | – | table:table-column |
table:table-column-group | A group of adjacent columns that can be shown or hidden as one; may nest. | table:display | columns, header columns, column groups |
table:table-row | A row, holding its cells. | table:style-name, table:default-cell-style-name, table:number-rows-repeated, table:visibility, xml:id | table:table-cell, table:covered-table-cell |
table:table-rows | A run of rows; means the same as if the tags were not there. | – | table:table-row, text:soft-page-break |
table:table-header-rows | Header rows: repeated at the top of every page the table runs onto. A reader that does not support them treats them as ordinary rows. | – | table:table-row, text:soft-page-break |
table:table-row-group | A group of adjacent rows that can be shown or hidden as one; may nest. | table:display | header rows, rows, row groups, text:soft-page-break |
table:table-cell | A cell. It may hold paragraphs, headings, lists, sections, nested tables, shapes and frames, annotations, or nothing. | see Cells | block content, shapes, table:cell-range-source, table:detective |
table:covered-table-cell | A cell position hidden by a cell that spans over it. There is one for each covered position, in document order. | as table:table-cell, without the span attributes | as table:table-cell |
table:shapes | Shapes anchored to the table. | – | drawing shapes and frames |
A table may have only one table:table-header-rows, unless it has row
groups: then the table and each group may have one, as long as all the header rows
are next to each other. The same applies to header columns and column groups. A
column group may contain header columns, but not the other way round.
Repeats, spans and covered cells
Adjacent columns with the same style may be written once with
table:number-columns-repeated. Adjacent rows with the same content and
style, and no vertically merged cells, may be written once with
table:number-rows-repeated. Adjacent cells with the same content and
style that are not merged may be written once with
table:number-columns-repeated. All three default to 1.
A merged cell is a table:table-cell with
table:number-columns-spanned and/or
table:number-rows-spanned greater than 1 (both default to 1). Every grid
position it covers must still be present as a
table:covered-table-cell, so each row always has the full number of
cell elements.
<table:table-row>
<table:table-cell table:number-columns-spanned="2" office:value-type="string">
<text:p>Name</text:p></table:table-cell>
<table:covered-table-cell/>
<table:table-cell office:value-type="string"><text:p>Total</text:p></table:table-cell>
</table:table-row>
Cells
| Attribute | Values | Meaning |
|---|---|---|
office:value-type | float, percentage, currency, date, time, boolean, string, void | The type of the cell’s value. The value is in the attribute for its type (below); the paragraphs inside the cell are the value as displayed. |
office:value | number | Value of a float, percentage or currency cell. |
office:currency | currency, such as USD | Currency of a currency cell. |
office:date-value | date or date-time | Value of a date cell. |
office:time-value | duration, such as PT03H30M00S | Value of a time cell. |
office:boolean-value | true, false | Value of a boolean cell. |
office:string-value | text | Value of a string cell when it differs from the displayed text. |
table:formula | prefix, colon, formula text | A formula. The namespace bound to the prefix says which formula language is used; with no prefix it is OpenFormula (urn:oasis:names:tc:opendocument:xmlns:of:1.2). |
table:number-columns-spanned, table:number-rows-spanned | positive integer, default 1 | How many columns and rows the cell covers. |
table:number-matrix-columns-spanned, table:number-matrix-rows-spanned | positive integer | Size of the matrix a matrix formula fills. |
table:number-columns-repeated | positive integer, default 1 | How many times the cell repeats to the right. |
table:style-name | style name | A cell style (family table-cell). If missing, the row’s table:default-cell-style-name is used, then the column’s, then the default style of the table-cell family. |
table:content-validation-name | name | A validity check the cell must pass. |
table:protected | true, false (default) | The cell cannot be edited. |
table:protect | true, false (default) | Old name for table:protected; deprecated. |
xhtml:about, xhtml:property, xhtml:content, xhtml:datatype | RDFa values | Metadata about the cell in RDFa form. |
xml:id | ID | An identifier, used by RDF metadata. |
When a row and a column both give a default cell style, the row’s wins.
Table, column and row attributes
| Attribute | On | Values | Meaning |
|---|---|---|---|
table:name | table | text | The table’s name, used in cell addresses. |
table:style-name | table, column, row | style name | A style of family table, table-column or table-row. |
table:default-cell-style-name | column, row | style name | Cell style for cells in this column or row that have none of their own. |
table:number-columns-repeated | column | positive integer, default 1 | How many adjacent columns this element describes. |
table:number-rows-repeated | row | positive integer, default 1 | How many identical adjacent rows this element stands for. |
table:visibility | column, row | visible (default), collapse, filter | Shown; hidden; hidden because a filter excludes it. |
table:display | row group, column group | true (default), false | Whether the group is shown. |
table:is-sub-table | table | true, false (default) | A nested table that fills its cell completely: no other content in the cell, its borders merge with the cell’s, and it has no style of its own. |
table:template-name | table | name | A table template (see Table templates). |
table:use-first-row-styles, table:use-last-row-styles, table:use-first-column-styles, table:use-last-column-styles | table | true, false (default) | Apply the template’s first-row, last-row, first-column or last-column cell style. |
table:use-banding-rows-styles, table:use-banding-columns-styles | table | true, false (default) | Apply the template’s even and odd row (or column) styles. |
table:print | table | true (default), false | Whether the table is printed. |
table:print-ranges | table | cell range address list | The cells to print. |
table:protected | table | true, false (default) | The table is protected; its cells are then protected only if their cell style has style:cell-protect other than none. |
table:protection-key | table | string (binary data) | The value needed to remove protection. |
table:protection-key-digest-algorithm | table | IRI, default http://www.w3.org/2000/09/xmldsig#sha1 | How the key was made. Readers must support …xmldsig#sha1 and …xmldsig#sha256. |
Table templates
A table:table-template element, a child of office:styles
(section 16.20), is a set of references to cell styles for building a table. Its
attributes are table:name and four deprecated ones:
table:first-row-start-column, table:first-row-end-column,
table:last-row-start-column and
table:last-row-end-column. A table uses it through
table:template-name, and the table:use-… switches above
(all default false) decide which parts apply. Each child element has
table:style-name (a style of family table-cell) and
table:paragraph-style-name. When more than one applies to a cell, the
first in this order is used:
table:first-columntable:last-columntable:first-rowtable:last-rowtable:even-rows,table:odd-rows(banded rows)table:even-columns,table:odd-columns(banded columns)table:body(cells no other element governs)
table:background (16.22) has only table:style-name: a
style of family table giving a background that shows through where the
table is transparent.
Spreadsheet features
The schema allows the spreadsheet parts of the table model (cell addresses and
ranges, linked tables with table:table-source, scenarios, detective
marks, cell range sources, validation, named ranges, database ranges, filters, data
pilot tables, consolidation) on any table; the specification does not restrict them
to spreadsheets, but they come from the spreadsheet side of the model and this page
does not repeat them. They are described on the
ODT tables page (addresses,
linked tables, scenarios, detective marks, formula settings) and belong to
ODS.
Source
OpenDocument Version 1.3, OASIS Standard, 27 April 2021, part 3 (schema), sections
9.1, 10.4.1 and 10.4.2 (frames), 16.20 to 16.22 (table templates), 19.393
(presentation:class) and the table: and office:
attributes in chapter 19; read for this page.