w:fldChar (Complex Field Character)
Marks the beginning, field separator, or end of a complex field using w:fldCharType (begin, separate, end).
Parent elements
Description
w:fldChar marks one of the three boundary points of a complex field: begin, separate, and end. It is defined in ECMA-376 Part 1 §17.16.18.
Complex fields span across multiple runs:
- A run containing
<w:fldChar w:fldCharType="begin"/>opens the field. - Runs between begin and separate contain
w:instrText(the field instruction, e.g.PAGE,TOC \o "1-3"). - A run containing
<w:fldChar w:fldCharType="separate"/>separates the instruction from the cached result. - Runs between separate and end contain the field result (displayed text, often hidden with
w:vanish). - A run containing
<w:fldChar w:fldCharType="end"/>closes the field.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:fldCharType |
ST_FldCharType |
begin, separate, end |
Position of this field character in the field sequence. |
w:dirty |
ST_OnOff |
true / false |
When true, the field result is stale and should be updated on open. |
w:fldLock |
ST_OnOff |
true / false |
When true, the field is locked and must not be updated. |
Examples
<!-- PAGE field -->
<w:r><w:fldChar w:fldCharType="begin"/></w:r>
<w:r><w:instrText xml:space="preserve"> PAGE </w:instrText></w:r>
<w:r><w:fldChar w:fldCharType="separate"/></w:r>
<w:r><w:t>1</w:t></w:r>
<w:r><w:fldChar w:fldCharType="end"/></w:r>
// begin
new Run(new FieldChar { FieldCharType = FieldCharValues.Begin }),
// instruction
new Run(new FieldCode(" PAGE ") { Space = SpaceProcessingModeValues.Preserve }),
// separate
new Run(new FieldChar { FieldCharType = FieldCharValues.Separate }),
// result
new Run(new Text("1")),
// end
new Run(new FieldChar { FieldCharType = FieldCharValues.End })