w:vMerge (Vertical Merge)
Marks a cell as part of a vertically merged group. The first cell uses w:val='restart'; subsequent cells omit the attribute.
Parent elements
Description
w:vMerge controls vertical cell merging (merging across rows). It is defined in ECMA-376 Part 1 §17.4.84.
The first cell in a vertical merge group uses <w:vMerge w:val="restart"/>. Every subsequent cell in the same column that is part of the merge uses <w:vMerge/> (no w:val), and must still contain a w:p (which will be ignored for layout purposes). The merge ends at the next row that does not have w:vMerge in that column.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:val |
ST_Merge |
restart (start a new merge group), or omitted/continue (continue an existing merge group). |
Marks the role of this cell in the vertical merge. |
Examples
<!-- Row 1: start of merge -->
<w:tc>
<w:tcPr><w:vMerge w:val="restart"/></w:tcPr>
<w:p><w:r><w:t>Merged cell</w:t></w:r></w:p>
</w:tc>
<!-- Row 2: continuation of merge -->
<w:tc>
<w:tcPr><w:vMerge/></w:tcPr>
<w:p/>
</w:tc>
// Row 1 (start)
new TableCell(
new TableCellProperties(new VerticalMerge { Val = MergedCellValues.Restart }),
new Paragraph(new Run(new Text("Merged cell"))));
// Row 2 (continue)
new TableCell(
new TableCellProperties(new VerticalMerge()),
new Paragraph());
Notes
- Continuation cells must still be present in the XML with an empty
w:p— they are required for the grid to be consistent. - Vertical merge and
w:gridSpancan be combined for complex merged regions.