API Reference
WordField
Represents a field element within a Word document.
Inheritance
- WordElement
- WordField
Methods
public static WordParagraph AddField(WordParagraph paragraph, WordFieldType wordFieldType, Nullable<WordFieldFormat> wordFieldFormat = null, String customFormat = null, Boolean advanced = false, List<String> parameters = null) #WordParagraphInserts 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 System.Nullable{OfficeIMO.Word.WordFieldFormat} = null
- Optional field format.
- customFormat System.String = null
- Custom format string for date or time fields.
- advanced System.Boolean = false
- Whether to use advanced field representation.
- parameters System.Collections.Generic.List{System.String} = null
- Additional switch parameters.
Returns
The WordParagraph containing the field.
public static WordParagraph AddField(WordParagraph paragraph, WordFieldCode fieldCode, Nullable<WordFieldFormat> wordFieldFormat = null, String customFormat = null, Boolean advanced = false) #WordParagraphInserts 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 System.Nullable{OfficeIMO.Word.WordFieldFormat} = null
- Optional field format.
- customFormat System.String = null
- Custom format string for date or time fields.
- advanced System.Boolean = false
- Whether to use advanced field representation.
Returns
The WordParagraph containing the field.
public static WordParagraph AddField(WordParagraph paragraph, WordFieldBuilder builder, Boolean advanced = false) #WordParagraphInserts a field constructed using WordFieldBuilder.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- Paragraph to add the field to.
- builder OfficeIMO.Word.WordFieldBuilder
- Field builder instance.
- advanced System.Boolean = false
- Whether to use advanced field representation.
Returns
The WordParagraph containing the field.
public Void Remove() #VoidDeletes all runs and simple field elements associated with this field.
public Void ReplaceWithText(String text) #VoidReplaces the current field with plain text.
Parameters
- text System.String
- Text to insert in place of the field.
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public Nullable<WordFieldType> FieldType { get; } #Gets the type of the current field.
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 Boolean UpdateField { get; set; } #Gets or sets a value indicating whether the field is marked dirty.
public Boolean LockField { get; set; } #Gets or sets a value indicating whether the field is locked.
public String Text { get; set; } #Gets or sets the display text of the field.