w:rPr (Run Properties)
Container for all character-level formatting properties applied to a run or paragraph mark.
Description
w:rPr is the run properties container, grouping all character-level formatting for a w:r element. It is defined in ECMA-376 Part 1 §17.3.2.28.
w:rPr can also appear inside w:pPr to set the properties of the paragraph mark (the non-printing character that ends a paragraph and carries its formatting). Additionally, w:rPr appears inside w:style to define character formatting for that style, or in w:lvl to define formatting for list item numbers.
Run properties are the primary mechanism for inline character formatting such as bold, italic, font, size, color, highlighting, and effects. Unlike block-level properties, run properties apply only to the specific run and do not carry forward to the next run unless explicitly reapplied.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
| (none) | — | — | All run properties are expressed via child elements. |
Child Elements by Category
Style & Fonts
| Element | Purpose | Example |
|———|———|———-|
| w:rStyle | Named character style | <w:rStyle w:val="Emphasis"/> |
| w:rFonts | Font family selection | <w:rFonts w:ascii="Calibri"/> |
Text Effects (Toggle)
| Element | Purpose | Example |
|———|———|———-|
| w:b | Bold text | <w:b/> |
| w:i | Italic text | <w:i/> |
| w:strike | Strikethrough | <w:strike/> |
| w:dStrike | Double strikethrough | <w:dStrike/> |
| w:caps | All capitals display | <w:caps/> |
| w:smallCaps | Small capitals display | <w:smallCaps/> |
| w:vanish | Hidden text | <w:vanish/> |
Underline & Borders
| Element | Purpose | Example |
|———|———|———-|
| w:u | Underline style | <w:u w:val="single"/> |
| w:outline | Outline text effect | <w:outline/> |
| w:shadow | Shadow text effect | <w:shadow/> |
Color & Highlight
| Element | Purpose | Example |
|———|———|———-|
| w:color | Font color (RGB or theme) | <w:color w:val="FF0000"/> |
| w:highlight | Text highlight color | <w:highlight w:val="yellow"/> |
| w:shd | Character background/fill | <w:shd w:fill="FFFF00"/> |
Size & Spacing
| Element | Purpose | Example |
|———|———|———-|
| w:sz | Font size in half-points | <w:sz w:val="24"/> (12 pt) |
| w:spacing | Character spacing | <w:spacing w:val="20"/> |
| w:kern | Pair kerning threshold | <w:kern w:val="24"/> |
Position & Alignment
| Element | Purpose | Example |
|———|———|———-|
| w:vertAlign | Subscript/superscript | <w:vertAlign w:val="superscript"/> |
| w:position | Vertical baseline shift | <w:position w:val="6"/> |
Language & Proofing
| Element | Purpose | Example |
|———|———|———-|
| w:lang | Language code | <w:lang w:val="en-US"/> |
| w:noProof | Skip spell-check | <w:noProof/> |
Examples
Simple bold and italic run
<w:r>
<w:rPr>
<w:b/>
<w:i/>
</w:rPr>
<w:t>Bold italic text</w:t>
</w:r>
var run = new Run(
new RunProperties(
new Bold(),
new Italic()),
new Text("Bold italic text"));
Complex formatting: font, size, color, highlight, underline
<w:r>
<w:rPr>
<w:rFonts w:ascii="Georgia" w:hAnsi="Georgia"/>
<w:b/>
<w:sz w:val="32"/>
<w:szCs w:val="32"/>
<w:color w:val="0070C0"/>
<w:highlight w:val="yellow"/>
<w:u w:val="double"/>
</w:rPr>
<w:t>Highlighted, underlined, colored text</w:t>
</w:r>
var run = new Run(
new RunProperties(
new RunFonts { Ascii = "Georgia", HighAnsi = "Georgia" },
new Bold(),
new FontSize { Val = "32" },
new FontSizeComplexScript { Val = "32" },
new Color { Val = "0070C0" },
new Highlight { Val = HighlightColorValues.Yellow },
new Underline { Val = UnderlineValues.Double }),
new Text("Highlighted, underlined, colored text"));
Superscript and character spacing
<w:r>
<w:rPr>
<w:vertAlign w:val="superscript"/>
<w:sz w:val="20"/>
</w:rPr>
<w:t>E</w:t>
</w:r>
<w:r><w:t>=mc</w:t></w:r>
<w:r>
<w:rPr>
<w:vertAlign w:val="superscript"/>
<w:sz w:val="20"/>
</w:rPr>
<w:t>2</w:t>
</w:r>
var runE = new Run(
new RunProperties(
new VerticalTextAlignment { Val = VerticalAlignmentRunValues.Superscript },
new FontSize { Val = "20" }),
new Text("E"));
var runEquals = new Run(new Text("=mc"));
var runSquared = new Run(
new RunProperties(
new VerticalTextAlignment { Val = VerticalAlignmentRunValues.Superscript },
new FontSize { Val = "20" }),
new Text("2"));
Font Size Reference
| Display | Half-Points (w:sz) | Points | Font Size |
|---|---|---|---|
| 8 pt | 16 | 8 | <w:sz w:val="16"/> |
| 10 pt | 20 | 10 | <w:sz w:val="20"/> |
| 12 pt | 24 | 12 | <w:sz w:val="24"/> (default body) |
| 14 pt | 28 | 14 | <w:sz w:val="28"/> |
| 18 pt | 36 | 18 | <w:sz w:val="36"/> |
| 24 pt | 48 | 24 | <w:sz w:val="48"/> |
| 28 pt | 56 | 28 | <w:sz w:val="56"/> |
Notes
- Child element order: Like
w:pPr, child elements must appear in the ECMA-376-specified order; the SDK enforces this automatically. - Complex scripts: Use
w:szCsfor complex scripts (Arabic, Hebrew); usew:bCs,w:iCsfor complex-script bold/italic. - Paragraph mark formatting: When
w:rPrappears inw:pPr, it formats the paragraph mark, affecting line spacing and some paragraph behaviors. - Style inheritance: Character styles (applied via
w:rStyle) provide a base that is overridden by direct properties in the samew:rPr. - Measurement units: Font sizes use half-points (so 24 = 12 pt); color uses hex RGB or theme color references.
- Toggle properties:
w:b,w:i,w:strike,w:dStrike,w:caps,w:smallCaps,w:vanishare on/off; presence = true, absence = false. - Color precedence: Shading (background) via
w:shdtakes precedence over highlight when both are present.
<w:r>
<w:rPr>
<w:b/>
<w:color w:val="FF0000"/>
<w:sz w:val="28"/>
</w:rPr>
<w:t>Styled text</w:t>
</w:r>
new Run(
new RunProperties(
new Bold(),
new Color { Val = "FF0000" },
new FontSize { Val = "28" }),
new Text("Styled text"));