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.

 public class Field : Element
Public Class Field
		Inherits Element

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.


          //--- Insert a field at the end of a new document
          WordApplication app = new WordApplication();
          Document doc = app.Create();
          Field fld =
               doc.InsertHyperlinkAfter("http://www.softartisans.com", "SoftArtisans");

          //--- Get the first field of an existing document
          WordApplication app = new WordApplication();
          Document doc = app.Open(@"C:\sample.doc");
          Field firstField = doc.GetElements(Element.Type.Field)[0];
        

          '--- Insert a field at the end of a new document
          Dim app As New WordApplication()
          Dim doc As Document = app.Create()
          Dim fld As Field = _
               doc.InsertHyperlinkAfter("http://www.softartisans.com", "SoftArtisans")

          '--- Get the first field of an existing document
          Dim app As New WordApplication()
          Dim doc As Document = app.Open("C:\sample.doc")
          Dim firstField As Field = doc.GetElements(Element.Type.Field)(0)
        

Name

Description

Code

Contents

Type

Name

Description

Update()

Name

Description

FieldType