WordField
OfficeIMO.Word
Represents a field element within a Word document.
Inheritance
- WordElement
- WordField
Usage
Explore 16 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 16
- Method WordDocument.AddCitation
- Method WordDocument.AddField
- Property WordDocument.Fields
- Method WordField.AddField
- Method WordFooter.AddField
- Property WordFooter.Fields
- Method WordHeader.AddField
- Property WordHeader.Fields
- Method WordHeaderFooter.AddField
- Property WordHeaderFooter.Fields
- Property WordPageNumber.Field
- Method WordParagraph.AddCitation
- Method WordParagraph.AddCrossReference
- Method WordParagraph.AddField
- Property WordParagraph.Field
- Property WordSection.Fields
Methods
public static WordField AddField(WordParagraph paragraph, WordFieldType wordFieldType, WordFieldFormat? wordFieldFormat = null, string? customFormat = null, bool advanced = false, List<string>? parameters = null) #Inserts a field into the specified paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- Paragraph to add the field to.
- wordFieldType OfficeIMO.Word.WordFieldType
- Type of the field.
- wordFieldFormat OfficeIMO.Word.WordFieldFormat? = null
- Optional field format.
- customFormat string? = null
- Custom format string for date or time fields.
- advanced bool = false
- Whether to use advanced field representation.
- parameters System.Collections.Generic.List<string>? = null
- Additional switch parameters.
public static WordField AddField(WordParagraph paragraph, WordFieldCode fieldCode, WordFieldFormat? wordFieldFormat = null, string? customFormat = null, bool advanced = false) #Inserts a field represented by a WordFieldCode into the specified paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- Paragraph to add the field to.
- fieldCode OfficeIMO.Word.WordFieldCode
- Field code instance describing instructions and switches.
- wordFieldFormat OfficeIMO.Word.WordFieldFormat? = null
- Optional field format.
- customFormat string? = null
- Custom format string for date or time fields.
- advanced bool = false
- Whether to use advanced field representation.
public static WordField AddField(WordParagraph paragraph, WordFieldBuilder builder, bool advanced = false) #Inserts a field constructed using WordFieldBuilder.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- Paragraph to add the field to.
- builder OfficeIMO.Word.WordFieldBuilder
- Field builder instance.
- advanced bool = false
- Whether to use advanced field representation.
public void Remove() #Deletes all runs and simple field elements associated with this field.
public void ReplaceWithText(string text) #Replaces the current field with plain text.
Parameters
- text string
- Text to insert in place of the field.
Inherited Methods
Properties
public WordParagraph Paragraph { get; } #Gets the containing paragraph handle for continuing paragraph authoring.
public IReadOnlyList<WordFieldFormat> FieldFormat { get; } #Gets the format switches applied to the field.
public List<string> FieldSwitches { get; } #Gets the raw switch parameters from the field code.
public List<string> FieldInstructions { get; } #Gets the instructions portion of the field code.
public bool UpdateField { get; set; } #Gets or sets a value indicating whether the field is marked dirty.
public bool LockField { get; set; } #Gets or sets a value indicating whether the field is locked.