Table Grid

The <tblGrid> element defines the grid for the table. All columns in the table (including the space before and after a row) reference this grid. Each <gridCol> defines a single grid column within the table’s layout, which is used to define the presence of a vertical line within the table. A <tblGrid> element can contain an arbitrary number of <gridCol> elements, where each <gridCol> element represents one grid column in the table and defines a single grid entry. When cells are laid out within this table, as discussed below, all cells will be forced to snap the shared column edges defined by this grid.

Returning to the earlier 'one-cell empty table' example, the table has one column with a width of 10,296 twentieths of a point. This measurement (twentieths of a point, or twips) is frequently used in WordprocessingML, and translates to 1/1440th of an inch (one-twentieth of a point, which is itself 1/72nd of an inch):.

<w:tblGrid>
  <w:gridCol w:w="10296"/>
</w:tblGrid>

Consider the following, more complex table that has two rows and two columns; the columns are not aligned:

This table is represented by laying out the cells on a table grid consisting of three table grid columns, each grid column representing a logical vertical column in the table:

The dashed lines represent the virtual vertical continuations of each table grid column, and the resulting table grid is represented as the following in WordprocessingML:

<w:tblGrid>
  <w:gridCol w:w="2952"/>
  <w:gridCol w:w="4416"/>
  <w:gridCol w:w="1488"/>
</w:tblGrid>
<w:tr>
  <w:tc>
    <w:tcPr>
      <w:tcW w:w="7368" w:type="dxa"/>
      <w:gridSpan w:val=”2”/>
    </w:tcPr>
    <w:p/>
  </w:tc>
  <w:tc>
    <w:tcPr>
      <w:tcW w:w="1488" w:type="dxa"/>
    </w:tcPr>
    <w:p/>
  </w:tc>
</w:tr>
<w:tr>
  <w:tc>
     <w:tcPr>
      <w:tcW w:w="2952" w:type="dxa"/>
    </w:tcPr>
    <w:p/>
  </w:tc>
  <w:tc>
    <w:tcPr>
      <w:tcW w:w="5904" w:type="dxa"/>
      <w:gridSpan w:val=”2”/>
    </w:tcPr>
    <w:p/>
  </w:tc>
</w:tr>

Notice that each of the cells which do not span one grid column (i.e., span two adjacent vertical lines) must specify this fact by supplying a <gridSpan> element with a value which determines how many grid columns this cell will span. Each <gridCol> element represents a shared 'column' in a table (to which the cells will snap) even if it doesn’t appear visually.