w:r (Text Run)
An inline region of text sharing a uniform set of character-level formatting properties.
Parent elements
Description
w:r is a run — the fundamental unit of formatted text in a paragraph. It is defined in ECMA-376 Part 1 §17.3.2.25.
A run groups one or more consecutive characters that share the same set of run properties (w:rPr). A paragraph may contain any number of runs. Each run can hold text (w:t), special characters (w:br, w:tab, w:sym), and inline objects (w:drawing, w:fldChar).
Runs are the lowest-level block of content in the paragraph model; they do not span paragraph boundaries.
Attributes
w:r has no attributes of its own. Content and formatting are specified through its child elements.
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
| (none) | — | — | All run identity and properties are expressed through child elements. |
Examples
Plain text run
<w:r>
<w:t>Hello, World!</w:t>
</w:r>
new Run(new Text("Hello, World!"));
Bold, 14pt run
<w:r>
<w:rPr>
<w:b/>
<w:sz w:val="28"/>
</w:rPr>
<w:t>Important!</w:t>
</w:r>
new Run(
new RunProperties(
new Bold(),
new FontSize { Val = "28" }),
new Text("Important!"));
Notes
- A single
w:rcan hold multiplew:telements, but all text in a run shares the samew:rPrproperties. - Whitespace between runs is not significant; use
w:t xml:space="preserve"to preserve leading/trailing spaces within text content.