w:vertAlign (Vertical Alignment)
Applies superscript or subscript vertical positioning to the run relative to the baseline.
Parent elements
Description
w:vertAlign positions the run text as superscript or subscript relative to the surrounding baseline. It is defined in ECMA-376 Part 1 §17.3.2.42.
The offset and size reduction applied to the glyphs are determined by the font and renderer; the element itself only specifies the intent. For precise control, combine with w:sz (to set absolute size) and character position adjustment via w:position.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:val |
ST_VerticalAlignRun |
baseline (default, no shift), superscript (raised above baseline), subscript (lowered below baseline) |
The vertical alignment mode for the run. |
Examples
<!-- E=mc<superscript>2</superscript> -->
<w:r><w:t>E=mc</w:t></w:r>
<w:r>
<w:rPr>
<w:vertAlign w:val="superscript"/>
</w:rPr>
<w:t>2</w:t>
</w:r>
new Run(new Text("E=mc")),
new Run(
new RunProperties(
new VerticalTextAlignment { Val = VerticalPositionValues.Superscript }),
new Text("2"));
Notes
w:vertAligndoes not change the physical font size; the renderer chooses an appropriate glyph size. To explicitly set a smaller size, addw:sz.w:val="baseline"can be used to explicitly cancel superscript/subscript inherited from a style.