Class FieldInstruction
A parsed field instruction: the field name, its positional arguments, its switches and any nested fields (ECMA-376 Part 1 §17.16.5).
public sealed class FieldInstruction
- Inheritance
-
FieldInstruction
- Inherited Members
Remarks
The model preserves the original order of arguments and switches so that ToInstructionString() reproduces an equivalent instruction. Quoting is preserved per token rather than reapplied by rule, because Word's comparison semantics depend on whether an operand was quoted.
Properties
- Arguments
Gets the positional arguments, in order.
- DatePicture
Gets the
@date/time picture, or null.
- GeneralFormat
Gets the
*general-format switch argument, or null.
- Name
Gets the field name as written, for example "MERGEFIELD". Never null.
- NumericPicture
Gets the
#numeric picture, or null.
- Switches
Gets the switches, in order.
Methods
- FindSwitch(string)
Returns the first switch with the given name, or null. Matching is case-sensitive on the switch character, as Word's switches are.
- HasSwitch(string)
Returns whether a switch is present.
- Parse(string?)
Parses a field instruction. A null or whitespace-only instruction yields an instruction whose Kind is Unknown and whose Name is empty; parsing never throws on malformed input.
- ToInstructionString()
Renders the instruction back to instruction syntax. The result is equivalent to the input, not necessarily byte-identical: runs of whitespace between tokens collapse to a single space and quoting is reapplied only where the value requires it or where the original had it.