w:r (Text Run)

An inline region of text sharing a uniform set of character-level formatting properties.

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>

Bold, 14pt run

<w:r>
  <w:rPr>
    <w:b/>
    <w:sz w:val="28"/>
  </w:rPr>
  <w:t>Important!</w:t>
</w:r>

Complex formatted run with multiple properties

<w:r>
  <w:rPr>
    <w:b/>
    <w:i/>
    <w:color w:val="0070C0"/>
    <w:sz w:val="24"/>
    <w:highlight w:val="yellow"/>
  </w:rPr>
  <w:t xml:space="preserve">Emphasized </w:t>
</w:r>

Run with special characters and drawing

<w:r>
  <w:rPr>
    <w:b/>
  </w:rPr>
  <w:t>Text with: </w:t>
</w:r>
<w:r>
  <w:br/>  <!-- Line break -->
</w:r>
<w:r>
  <w:tab/>  <!-- Tab character -->
</w:r>
<w:r>
  <w:drawing>
    <!-- Inline image or shape -->
  </w:drawing>
</w:r>

Run Content Model

Child Element Type Purpose Can Repeat
w:rPr Properties Character/run formatting No (0 or 1)
w:t Text Text content Yes (multiple runs)
w:br Control Line/page/column break Yes
w:tab Control Tab character Yes
w:instrText Control Field instruction text Yes
w:fldChar Control Field boundary marker Yes
w:delText Text Deleted text (tracking changes) Yes
w:sym Special Symbol/special character Yes
w:drawing Object Embedded image, shape, object Yes

Key Characteristics

  • Minimum Formatting Unit: Runs are the smallest block of consistently formatted text.
  • Homogeneous Properties: All text in a run shares identical character formatting.
  • Paragraph-Scoped: Runs cannot span paragraph boundaries; they must be children of w:p or similar container.
  • Sequential: Multiple runs in a paragraph are rendered sequentially without gaps.
  • Content Flexibility: Single run can mix text, whitespace, line breaks, tabs, symbols, and embedded objects.
  • No Direct Style: Runs don’t directly reference styles; formatting comes from w:rPr child element.
  • Inheritance: If no w:rPr specified, run inherits formatting from parent paragraph’s style.

Run with Tab and Line Break

<w:r>
  <w:rPr><w:b/></w:rPr>
  <w:t>Column 1</w:t>
</w:r>
<w:r><w:tab/></w:r>
<w:r><w:t>Column 2</w:t></w:r>
<w:r><w:br/></w:r>
<w:r><w:t>Next line</w:t></w:r>

Font Size Reference

Point Size Half-Points Example Use Case
8pt 16 Fine print, footnotes
10pt 20 Standard body text
12pt 24 Default document text
14pt 28 Headings, emphasis
16pt 32 Major headings
18pt 36 Large headings
24pt 48 Document title

Notes

  • Runs vs. paragraphs: Runs never span paragraph boundaries; formatting changes require a new run. Multiple runs in a paragraph render sequentially.
  • Empty runs: A run with no text content (<w:r></w:r>) is valid but unusual; it typically contains only properties or special elements.
  • Run content: A single w:r can contain multiple w:t elements, but all text in the run shares the same w:rPr properties.
  • Hyperlinks: Runs inside w:hyperlink gain hyperlink behavior; the run itself does not carry the link target.
  • Change tracking: Deleted text uses w:delText instead of w:t; w:ins and w:del wrap runs to mark insertions and deletions.
  • Field codes: Runs with w:instrText and w:fldChar implement fields such as mail merge, tables of contents, and dates. A field uses begin, instruction, and end markers rather than a plain text string.
  • Whitespace: Use xml:space="preserve" on w:t to keep leading or trailing whitespace; XML parsers otherwise strip it.
  • Special characters: Use w:tab, w:br, and w:sym for tabs, line breaks, and symbol-font characters rather than literal text characters.
  • Text direction: Complex scripts such as Arabic and Hebrew use bCs, iCs, and szCs variants in w:rPr for bidirectional text handling.
  • Inline objects: Use w:drawing for images, shapes, and charts; anchored or inline positioning is determined by shape properties.
  • Property inheritance: Without w:rPr, a run inherits formatting from paragraph mark properties (w:pPr/w:rPr) or its applied style.
  • Performance: Excessive small runs can affect rendering speed; split very long runs (over 10,000 characters) when doing so improves processing.
  • Accessibility: Provide meaningful text and alternative text for drawings; avoid runs containing only formatting or whitespace without descriptive context.