OfficeIMO

API Reference

Class

WordField

Namespace OfficeIMO.Word
Assembly OfficeIMO.Word

Represents a field element within a Word document.

Inheritance

Methods

AddField 3 overloads
public static WordParagraph AddField(WordParagraph paragraph, WordFieldType wordFieldType, Nullable<WordFieldFormat> wordFieldFormat = null, String customFormat = null, Boolean advanced = false, List<String> parameters = null) #
Returns: WordParagraph

Inserts a field into the specified paragraph.

Parameters

paragraph OfficeIMO.Word.WordParagraph requiredposition: 0
Paragraph to add the field to.
wordFieldType OfficeIMO.Word.WordFieldType requiredposition: 1
Type of the field.
wordFieldFormat System.Nullable{OfficeIMO.Word.WordFieldFormat} = null optionalposition: 2
Optional field format.
customFormat System.String = null optionalposition: 3
Custom format string for date or time fields.
advanced System.Boolean = false optionalposition: 4
Whether to use advanced field representation.
parameters System.Collections.Generic.List{System.String} = null optionalposition: 5
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) #
Returns: WordParagraph

Inserts a field represented by a WordFieldCode into the specified paragraph.

Parameters

paragraph OfficeIMO.Word.WordParagraph requiredposition: 0
Paragraph to add the field to.
fieldCode OfficeIMO.Word.WordFieldCode requiredposition: 1
Field code instance describing instructions and switches.
wordFieldFormat System.Nullable{OfficeIMO.Word.WordFieldFormat} = null optionalposition: 2
Optional field format.
customFormat System.String = null optionalposition: 3
Custom format string for date or time fields.
advanced System.Boolean = false optionalposition: 4
Whether to use advanced field representation.

Returns

The WordParagraph containing the field.

public static WordParagraph AddField(WordParagraph paragraph, WordFieldBuilder builder, Boolean advanced = false) #
Returns: WordParagraph

Inserts a field constructed using WordFieldBuilder.

Parameters

paragraph OfficeIMO.Word.WordParagraph requiredposition: 0
Paragraph to add the field to.
builder OfficeIMO.Word.WordFieldBuilder requiredposition: 1
Field builder instance.
advanced System.Boolean = false optionalposition: 2
Whether to use advanced field representation.

Returns

The WordParagraph containing the field.

public Void Remove() #
Returns: Void

Deletes all runs and simple field elements associated with this field.

public Void ReplaceWithText(String text) #
Returns: Void

Replaces the current field with plain text.

Parameters

text System.String requiredposition: 0
Text to insert in place of the field.

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 String Field { get; } #

Gets the raw 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.