w:textAlignment (Vertical Text Alignment)
Specifies the vertical alignment of text within each line for paragraphs containing mixed-size content.
Parent elements
Description
w:textAlignment controls how the baseline and bounding box of characters within a line relate to one another when multiple font sizes or scripts are mixed on a single line. It is particularly important for East Asian typography where ideographic characters and Western characters coexist.
It is defined in ECMA-376 Part 1 §17.3.1.39.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:val |
ST_TextAlignment |
auto, baseline, bottom, center, top |
Controls vertical alignment within the line. |
Values
| Value | Description |
|---|---|
auto |
Alignment determined automatically by the processor (default). |
baseline |
Characters aligned on the Latin text baseline. |
bottom |
Characters aligned at the bottom of the em box (bottom of ideographic characters). |
center |
Characters centered vertically in the em box. |
top |
Characters aligned at the top of the em box. |
Examples
<!-- Align mixed-script content to the Latin baseline -->
<w:p>
<w:pPr>
<w:textAlignment w:val="baseline"/>
</w:pPr>
<w:r><w:t>English and 日本語 aligned to baseline.</w:t></w:r>
</w:p>
using DocumentFormat.OpenXml.Wordprocessing;
var para = new Paragraph(
new ParagraphProperties(
new TextAlignment { Val = VerticalTextAlignmentValues.Baseline }
),
new Run(new Text("English and 日本語 aligned to baseline."))
);
Notes
- The most commonly observed values are
autoandbaseline. - This property is distinct from the table cell vertical alignment (
w:vAligninw:tcPr) and the page vertical alignment (w:vAligninw:sectPr).