2.4.3 Overview of Tables

Office

A table cell consists of one or more paragraphs at the same nonzero table depth and, optionally, one or more tables whose table depth is one greater than that of the containing cell. The last paragraph in a table cell is terminated by a cell mark. If the table depth is 1, the cell mark MUST be character Unicode 0x0007. If the table depth is greater than 1, the cell mark MUST be a paragraph mark (Unicode 0x000D) with sprmPFInnerTableCell applied with a value of 1.

A table row has between 1 and 63 table cells, each at the same table depth, followed by a Table Terminating Paragraph mark (TTP mark, also called a row mark), also at the same table depth. If the table depth is 1, then the TTP mark MUST be a character Unicode 0x0007 with sprmPFTtp applied with a value of 1. If the table depth is greater than 1, then the TTP mark MUST be a paragraph mark (Unicode 0x000D) with sprmPFInnerTtp applied with a value of 1.

The table depth of a paragraph, table cell, or table row, is derived from the values of sprmPFInTable, sprmPItap, and sprmPDtap applied as direct paragraph properties to the paragraph mark, cell mark, or TTP mark. See section 2.4.6.1, Direct Paragraph Formatting for further specifications. Paragraphs that are not in a table have a table depth of zero.

The following [ABNF] rulelist defines a table at depth N (TableN) in terms of paragraphs at depth N (ParaN), cell marks at depth N (CellMarkN), TTP marks at depth N (TTPN), and tables at depth N+1 (TableN1). ABNF is specified in [RFC4234].

Cell N = times open parentheses Table N1 divided by Para N closed parentheses Cell Mark N. Row N = 1 times 63 Cell N TTPN. Table N = 1 times Row N.

Two adjacent table rows of the same table depth are considered part of the same table unless they differ in one of the following properties:

  • The operand to sprmTIpgp

  • The table style, as specified by sprmTIstd

  • The table directionality as specified by sprmTFBidi or sprmTFBidi90

  • The table position and wrapping as specified by sprmTPc, sprmTFNoAllowOverlap, sprmTDxaAbs, sprmTDyaAbs, sprmTDxaFromText, sprmTDyafromText, sprmTDxaFromTextRight, and sprmTDyaFromTextBottom

If neither table row specifies nondefault values for the preceding table position and wrapping properties, then two adjacent table rows of the same table depth are considered different tables if the first paragraphs of the first cells of the rows differ in any of the paragraph frame properties specified by sprmPPc, sprmPDxaAbs, sprmPDyaAbs, sprmPDxaWidth, sprmPWHeightAbs, sprmPDcs, sprmPWr, sprmPDxaFromText, sprmPDyaFromText, sprmPFLocked, sprmPFNoAllowOverlap, and sprmPFrameTextFlow.

In addition, two table rows are considered part of different tables if a range-level protection bookmark is present whose type, as specified by the sdtt member of the corresponding SDTI, is sdttPara and that bookmark (1) contains content from more than one table cell but does not contain the entirety of both rows.

The properties of each row mark MUST define the cells for that table row. SprmTDefTable and sprmTInsert are used to create cell definitions, and sprmTDelete is used to remove them. The number of cell definitions applied to the row mark MUST be equal to the number of cells in the row. There is no requirement that each row of a table have the same number of cells.

An application SHOULD<10> use sprmTDefTable to define table cells for applications that do not process sprmPTableProps, and at the same time use sprmTInsert for applications that do process sprmPTableProps.

The following diagram shows several elements of a table and gives examples of Sprms that can be used to modify each. The table in this example includes spacing between cells to demonstrate borders and shading. It includes a nested table to demonstrate table depth.

A sample table

Figure 1: A sample table

To determine which borders are displayed, see the following sections from [ECMA-376] Part 4:

  • Section 2.4.63 tcBorders (Table Cell Borders)

  • Section 2.4.37 tblBorders (Table Border Exceptions)

  • Section 2.4.38 tblBorders (Table Borders)

Cells can be vertically merged to create the appearance of a single cell spanning multiple rows. The cell mark characters for the merged cells MUST still appear in the file. The second and subsequent cells in the merged group MUST NOT contain any content other than their cell marks. The following diagram shows a table with vertically merged cells. It uses inside borders to demonstrate that the vertically merged cells act as one cell.

A table with vertically merged cells

Figure 2: A table with vertically merged cells

Show: