w:tcMar (Table Cell Margins)

Overrides the default table cell margins for an individual cell, specifying padding on each side independently.

Parent elements

Child elements

Description

w:tcMar sets cell-specific padding (the space between the cell border and the cell content). It overrides the table-level default cell margins (w:tblCellMar in w:tblPr) for the cell it belongs to.

It is defined in ECMA-376 Part 1 §17.4.69.

Each side is specified by a child element with w:w (amount) and w:type (unit) attributes.

Child Elements

Element Description
w:top Top padding.
w:left Left (leading) padding.
w:bottom Bottom padding.
w:right Right (trailing) padding.

Each child uses the same attribute set as w:tblCellMar children:

Attribute Type Description
w:w xsd:integer Amount of padding.
w:type ST_TblWidth dxa (twips), nil (no padding).

Examples

<!-- Uniform 0.1 inch (144 twips) padding on all sides -->
<w:tc>
  <w:tcPr>
    <w:tcMar>
      <w:top    w:w="144" w:type="dxa"/>
      <w:left   w:w="144" w:type="dxa"/>
      <w:bottom w:w="144" w:type="dxa"/>
      <w:right  w:w="144" w:type="dxa"/>
    </w:tcMar>
  </w:tcPr>
  <w:p><w:r><w:t>Padded cell</w:t></w:r></w:p>
</w:tc>
<!-- Asymmetric padding: more left/right, less top/bottom -->
<w:tcMar>
  <w:top    w:w="72" w:type="dxa"/>
  <w:left   w:w="216" w:type="dxa"/>
  <w:bottom w:w="72" w:type="dxa"/>
  <w:right  w:w="216" w:type="dxa"/>
</w:tcMar>

Common Padding Values

Padding Twips Inches mm
Minimal 36 0.025 0.64
Small 72 0.05 1.27
Default 144 0.1 2.54
Medium 216 0.15 3.81
Generous 288 0.2 5.08

Notes

  • Twips Conversion: 1440 twips = 1 inch; divide by 1440 to convert to inches.
  • Omitted Sides: Omitting a child element means that side inherits table default (w:tblCellMar).
  • Nil Type: Use w:type="nil" to set a side to zero padding (overrides table default).
  • Cell Override: Cell margins override table-level defaults from w:tblCellMar.
  • Content Spacing: Margins control space between cell border and content.
  • Text Direction: Works consistently with horizontal and vertical text.
  • Table Interaction: Does not affect table borders; only affects internal cell padding.
  • Asymmetric Padding: Common for data tables to pad left/right more than top/bottom.
  • RTL Tables: Left/right semantics apply to logical left/right, not screen left/right.
  • Compatibility: Cell margins render consistently across all Office versions.