Class
WordFieldBuilder
OfficeIMO.Word
Provides a fluent builder for constructing field codes including nested fields.
Inheritance
- WordFieldCode
- WordFieldBuilder
Usage
Explore 11 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 4
Accepted by parameters 7
- Method WordDocument.AddField
- Method WordField.AddField
- Method WordFieldBuilder.AddInstruction
- Method WordFooter.AddField
- Method WordHeader.AddField
- Method WordHeaderFooter.AddField
- Method WordParagraph.AddField
Constructors
public WordFieldBuilder(WordFieldType fieldType) #Initializes a new instance for the specified WordFieldType.
Parameters
- fieldType OfficeIMO.Word.WordFieldType
Methods
AddInstruction 2 overloads
public WordFieldBuilder AddInstruction(string instruction, bool quoted = false) #Adds an instruction to the field code.
Parameters
- instruction string
- Instruction to append.
- quoted bool = false
- When true, the instruction is wrapped in quotes.
public WordFieldBuilder AddInstruction(WordFieldBuilder field) #Adds a nested field as an instruction.
Parameters
- field OfficeIMO.Word.WordFieldBuilder
- Nested field builder.
public WordFieldBuilder AddSwitch(string value) #Adds a switch to the field code.
Parameters
- value string
- Switch string including leading backslash.
public WordFieldBuilder SetCustomFormat(string format) #Sets a custom date or time format.
Parameters
- format string
- Custom format string.
public WordFieldBuilder SetFormat(WordFieldFormat format) #Applies a format switch to the field code.
Parameters
- format OfficeIMO.Word.WordFieldFormat
- Format switch to apply.