w:instrText (Field Instruction Text)

Contains the instruction string (e.g., 'TOC \o 1-3') for a complex field between begin and end fldChar elements.

Parent elements

Description

w:instrText carries the instruction text of a complex field (between the begin and separate w:fldChar markers). It is defined in ECMA-376 Part 1 §17.16.23.

The field instruction text uses the same syntax as simple field instructions (e.g. PAGE, DATE \@ "d MMMM yyyy", TOC \o "1-3" \h). Use xml:space="preserve" to ensure leading/trailing spaces in the instruction are not stripped by XML parsers.

Attributes

Attribute Type Possible Values Description
xml:space XML standard preserve Preserves surrounding whitespace in the instruction text. Always recommended.

Examples

<w:r>
  <w:instrText xml:space="preserve"> DATE \@ "d MMMM yyyy" </w:instrText>
</w:r>

Notes

  • Runs carrying w:instrText commonly also carry w:rPr with w:vanish so the raw instruction is not displayed in normal view.
  • For simple (non-updateable) fields, prefer w:fldSimple which uses a single element rather than the three-run begin/separate/end pattern.