w:tr (Table Row)

Contains a single row of table cells and the row-level formatting properties.

Parent elements

Child elements

Description

w:tr is a table row — a horizontal grouping of one or more table cells (w:tc). It is defined in ECMA-376 Part 1 §17.4.79.

Each row can optionally start with a w:trPr element specifying row-level properties such as height, header row flag, or row-level conditional format bands. Cells follow in document order from left to right.

Attributes

Attribute Type Possible Values Description
w:rsidR ST_LongHexNumber 8-digit hex string Revision save ID tracking when this row was inserted. (Internal bookkeeping, not displayed.)
w:rsidDel ST_LongHexNumber 8-digit hex string Revision save ID tracking when this row was deleted.
w:rsidTr ST_LongHexNumber 8-digit hex string Revision save ID tracking when this row’s properties were changed.

Child Elements

Child Purpose Order
w:trPr Row-level properties (height, repeat-header flag, etc.) First (optional)
w:tc (repeatable) Table cells (one per column) Second onward

Examples

Simple row with two cells

<w:tr>
  <w:tc>
    <w:p><w:r><w:t>Column 1</w:t></w:r></w:p>
  </w:tc>
  <w:tc>
    <w:p><w:r><w:t>Column 2</w:t></w:r></w:p>
  </w:tc>
</w:tr>

Row with exact height and cells with spanning

<w:tr>
  <w:trPr>
    <w:trHeight w:val="360" w:type="exact"/>
  </w:trPr>
  <w:tc>
    <w:tcPr><w:gridSpan w:val="2"/></w:tcPr>
    <w:p><w:r><w:t>Spans 2 columns</w:t></w:r></w:p>
  </w:tc>
  <w:tc>
    <w:p><w:r><w:t>Column 3</w:t></w:r></w:p>
  </w:tc>
</w:tr>

Header row (repeat on each page)

<w:tr>
  <w:trPr>
    <w:tblHeader/>
  </w:trPr>
  <w:tc>
    <w:tcPr><w:shd w:fill="D3D3D3"/></w:tcPr>
    <w:p><w:pPr><w:jc w:val="center"/></w:pPr><w:r><w:t>Header 1</w:t></w:r></w:p>
  </w:tc>
  <w:tc>
    <w:tcPr><w:shd w:fill="D3D3D3"/></w:tcPr>
    <w:p><w:pPr><w:jc w:val="center"/></w:pPr><w:r><w:t>Header 2</w:t></w:r></w:p>
  </w:tc>
</w:tr>

Table Row Properties

Property Purpose Example
w:trHeight Row height with rule <w:trHeight w:val="360" w:type="exact"/> (fixed 0.25 in)
w:tblHeader Mark as header row <w:tblHeader/> (repeats on each page)
w:tblCellSpacing Cell spacing for this row <w:tblCellSpacing w:w="60" w:type="dxa"/>
w:wBefore / w:wAfter Conditional row banding Rarely used; controlled by table w:tblLook
w:cnfStyle Conditional formatting style Rare; part of conditional formatting scheme
w:cantSplit Keep row together (no page break) <w:cantSplit/>

Row Height Rules

Rule Behavior Typical Use
auto (default) Row height = tallest cell content Dynamic, content-driven
atLeast Row height = at least specified value; may grow Minimum height guarantee
exact Row height = exact value; content may overflow Fixed-height layouts

Notes

  • Minimum row size: Every w:tr must contain at least one w:tc (table cell); empty rows are invalid.
  • Cell count consistency: While not required by ECMA-376, best practice is to ensure each row has the same number of logical cells (accounting for w:gridSpan); inconsistent row structures can confuse rendering engines.
  • Row properties first: When w:trPr is present, it must be the first child element; placing it after cells is invalid.
  • Repeat header: Use w:tblHeader in w:trPr to mark a row as a header row; it will repeat at the top of each page when the table spans pages.
  • Row height: Row height is specified in w:trPr/w:trHeight; type can be auto (minimum), atLeast (minimum), or exact (fixed); if not specified, row height is automatic based on content.
  • Cell spanning: Column spanning is controlled via w:gridSpan in the cell’s w:tcPr, not at the row level; vertical spans use w:vMerge.
  • Revision tracking: The rsid* attributes track which editing session inserted, deleted, or modified the row; they are informational and can be omitted by conforming producers.
  • Row border overrides: Cell-level borders in w:tcPr/w:tcBorders override table-level borders; this allows custom borders per row or cell.
  • Keep Together: Use w:cantSplit to prevent page breaks within the row; useful for multi-line header rows.
  • Performance: Rows with many cells (>20) or very complex cell content can impact rendering performance.
  • Accessibility: Use w:tblHeader to mark header rows so screen readers can announce them appropriately; ensure heading content is meaningful.