Vertically Merged Cells
Although the previous examples may have implied that tables have strict definition of rows, table cells can also be merged vertically. The <tcPr>
element may contain the <vmerge>
element that defines the extent of vertically merged grid columns within a table. A <vmerge>
element with its @val
attribute set to restart
marks the start of a vertically merged cell range. A <vmerge>
element with the @val
attribute set to continue
(the default value) marks the continuation of a vertically merged grid column. Cells between the first and last merged cell that are part of the vertical merge each must have a <vmerge>
element to continue the vertical merge.
For example, consider a table with two rows and two columns:
First cell, first row |
Last cell, first row |
First cell, second row |
Last cell, second row |
Merging the two rows in the second column will result in the following table:
First cell, first row |
Last cell, first rowLast cell, second row |
First cell, second row |
The last cell in the first row starts a merge that is completed in the cell below it, resulting in the following WordprocessingML:
<w:tr> <w:tc> <w:p> <w:r> <w:t>First cell, first row</w:t> </w:r> </w:p> </w:tc> <w:tc> <w:tcPr> <w:vmerge w:val="restart"/> </w:tcPr> <w:p> <w:r> <w:t>Last cell, first row</w:t> </w:r> </w:p> <w:p> <w:r> <w:t>Last cell, second row</w:t> </w:r> </w:p> </w:tc> </w:tr> <w:tr> <w:tc> <w:p> <w:r> <w:t>First cell, second row</w:t> </w:r> </w:p> </w:tc> <w:tc> <w:tcPr> <w:vmerge/> </w:tcPr> <w:p/> </w:tc> </w:tr>
As shown, the <vmerge>
with a value of restart
begins (or restarts) a merged region, and the cell with no value is merged with the one above.