Page tree
Skip to end of metadata
Go to start of metadata

Description

This class is a low level representation of a field. This encompasses many objects in Word, such as merge fields, hyperlinks, TOC entries, etc. Fields are the generic form of what are contained in a Element's inline elements.

C#
vb.net

Remarks

To create a field, call the corresponding "insert" method for what you want to create (hyperlink, TOC entry, etc) on an Element or Position object.

To get an existing field, use the Element.GetElements() method and pass in the Element.Type.Field parameter to retrieve all fields.

The following sample demonstrates creating a field at the end of a new document and retrieving the first field of an existing document.

Examples

C#
vb.net

Properties

Name

Description

Code

Returns a String that represents this field's code.

Contents

Returns an Element object that represents the contents of this field.

Type

Returns a Field.FieldType object that represents this field's type.

Methods

Name

Description

Update()

Updates the value of the field.

Nested Classes

Name

Description

FieldType

The Field class is a general representation that encompasses many Word objects, including merge fields, hyperlinks, and table of contents items. A Field.FieldType value specifies the type of field a specific Field object represents.
  • No labels