Message-ID: <65419728.10039.1711710585407.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_10038_1002256628.1711710585407" ------=_Part_10038_1002256628.1711710585407 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This class is a low level representation of a field. This encompasses ma= ny objects in Word, such as merge fields, hyperlinks, TOC entries, etc. Fie= lds are the generic form of what are contained in a Element's inline elemen= ts.
=20public class Field : Element=20
Public Class Field =09=09Inherits Element=20
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.
=20To get an existing field, use the Element.GetElements() method and pass in= the Element.Type.Field parameter to retrieve all fields.
=20The following sample demonstrates creating a field at the end of a new d= ocument and retrieving the first field of an existing document.
=20//--- Insert a field at the end of a new document WordApplication app =3D new WordApplication(); Document doc =3D app.Create(); Field fld =3D doc.InsertHyperlinkAfter("http://www.softartisans.com&q= uot;, "SoftArtisans"); //--- Get the first field of an existing document WordApplication app =3D new WordApplication(); Document doc =3D app.Open(@"C:\sample.doc"); Field firstField =3D doc.GetElements(Element.Type.Field)[0];=20
'--- Insert a field at the end of a new document Dim app As New WordApplication() Dim doc As Document =3D app.Create() Dim fld As Field =3D _ doc.InsertHyperlinkAfter("http://www.softartisans.com&q= uot;, "SoftArtisans") '--- Get the first field of an existing document Dim app As New WordApplication() Dim doc As Document =3D app.Open("C:\sample.doc") Dim firstField As Field =3D doc.GetElements(Element.Type.Field)(0= )=20
Name | =20
Description | =20
---|---|
Code<= /p> | =20
Returns a String that represents th=
is field's code. | =20
=20 | Returns an Elem= ent object that represents the contents of this field. | =20
Type<= /p> | =20
Returns a Field.FieldType object that represents this field's type. | =20
Name | =20
Description | =20
---|---|
=20 | Updates the value of the field. | =20
Name | =20
Description | =20
---|---|
=20 | The Field cla= ss is a general representation that encompasses many Word objects, includin= g merge fields, hyperlinks, and table of contents items. A Field.FieldType value specifies the type of fi= eld a specific Field object represents.<= /td>=20 |