w:pStyle (Paragraph Style Reference)
References a named paragraph style by its styleId, applying all properties of that style.
Parent elements
Description
w:pStyle references a named paragraph style by its styleId, applying all paragraph and run properties defined in that style. It is defined in ECMA-376 Part 1 §17.3.1.27.
The w:val must match the w:styleId attribute of a w:style element with w:type="paragraph" in styles.xml. Direct properties in w:pPr take precedence over those from the referenced style.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:val |
ST_String |
Any paragraph style ID, e.g. Normal, Heading1, ListParagraph, Caption. |
References the paragraph style to apply. |
Examples
<w:p>
<w:pPr>
<w:pStyle w:val="Heading1"/>
</w:pPr>
<w:r>
<w:t>Introduction</w:t>
</w:r>
</w:p>
new Paragraph(
new ParagraphProperties(
new ParagraphStyleId { Val = "Heading1" }),
new Run(new Text("Introduction")));
Notes
- Style IDs are locale-independent internal identifiers; the display name shown in the UI is stored in
w:style/w:name. - If
w:valreferences a style that does not exist, the application applies the default paragraph style.