Click or drag to resize
FieldType Enumeration
Specifies Microsoft Word field types.

Namespace: Aspose.Words.Fields
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public enum FieldType
Members
  Member nameValueDescription
FieldNone0 Field type is not specified or unknown.
FieldCannotParse1 Specifies that the field was unable to be parsed.
FieldAddin81 Specifies the ADDIN field.
FieldAddressBlock93 Specifies the ADDRESSBLOCK field.
FieldAdvance84 Specifies the ADVANCE field.
FieldAsk38 Specifies the ASK field.
FieldAuthor17 Specifies the AUTHOR field.
FieldAutoNum54 Specifies the AUTONUM field.
FieldAutoNumLegal53 Specifies the AUTONUMLGL field.
FieldAutoNumOutline52 Specifies the AUTONUMOUT field.
FieldAutoText79 Specifies the AUTOTEXT field.
FieldAutoTextList89 Specifies the AUTOTEXTLIST field.
FieldBarcode63 Specifies the BARCODE field.
FieldBibliography100500 Specifies the BIBLIOGRAPHY field.
FieldBidiOutline92 Specifies the BIDIOUTLINE field.
FieldCitation1980 Specifies the CITATION field.
FieldComments19 Specifies the COMMENTS field.
FieldCompare80 Specifies the COMPARE field.
FieldCreateDate21 Specifies the CREATEDATE field.
FieldData40 Specifies the DATA field.
FieldDatabase78 Specifies the DATABASE field.
FieldDate31 Specifies the DATE field.
FieldDDE45 Specifies the DDE field.
FieldDisplayBarcode6301 Specifies the DISPLAYBARCODE field.
FieldMergeBarcode6302 Specifies the MERGEBARCODE field.
FieldDDEAuto46 Specifies the DDEAUTO field.
FieldDocProperty85 Specifies the DOCPROPERTY field.
FieldDocVariable64 Specifies the DOCVARIABLE field.
FieldEditTime25 Specifies the EDITTIME field.
FieldEmbed58 Specifies the EMBED field.
FieldEquation49 Specifies the EQ field.
FieldFileName29 Specifies the FILENAME field.
FieldFileSize69 Specifies the FILESIZE field.
FieldFillIn39 Specifies the FILLIN field.
FieldFootnoteRef5 Specifies the FOOTNOTEREF field.
FieldFormCheckBox71 Specifies the FORMCHECKBOX field.
FieldFormDropDown83 Specifies the FORMDROPDOWN field.
FieldFormTextInput70 Specifies the FORMTEXT field.
FieldFormula34 Specifies the = (formula) field.
FieldGreetingLine94 Specifies the GREETINGLINE field.
FieldGlossary47 Specifies the GLOSSARY field.
FieldGoToButton50 Specifies the GOTOBUTTON field.
FieldHtmlActiveX91 Specifies the field that represents an HTML control.
FieldHyperlink88 Specifies the HYPERLINK field.
FieldIf7 Specifies the IF field.
FieldInclude36 Specifies the INCLUDE field.
FieldIncludePicture67 Specifies the INCLUDEPICTURE field.
FieldIncludeText68 Specifies the INCLUDETEXT field.
FieldIndex8 Specifies the INDEX field.
FieldIndexEntry4 Specifies the XE field.
FieldInfo14 Specifies the INFO field.
FieldImport55 Specifies the IMPORT field.
FieldKeyword18 Specifies the KEYWORDS field.
FieldLastSavedBy20 Specifies the LASTSAVEDBY field.
FieldLink56 Specifies the LINK field.
FieldListNum90 Specifies the LISTNUM field.
FieldMacroButton51 Specifies the MACROBUTTON field.
FieldMergeField59 Specifies the MERGEFIELD field.
FieldMergeRec44 Specifies the MERGEREC field.
FieldMergeSeq75 Specifies the MERGESEQ field.
FieldNext41 Specifies the NEXT field.
FieldNextIf42 Specifies the NEXTIF field.
FieldNoteRef72 Specifies the NOTEREF field.
FieldNumChars28 Specifies the NUMCHARS field.
FieldNumPages26 Specifies the NUMPAGES field.
FieldNumWords27 Specifies the NUMWORDS field.
FieldOcx87

Specifies the OCX field.

Normally, Aspose.Words will represent an ActiveX control as a Shape object, but for some documents, where a control does not have data and/or seems to be invalid, it will be represented as a field.

FieldPage33 Specifies the PAGE field.
FieldPageRef37 Specifies the PAGEREF field.
FieldPrint48 Specifies the PRINT field.
FieldPrintDate23 Specifies the PRINTDATE field.
FieldPrivate77 Specifies the PRIVATE field.
FieldQuote35 Specifies the QUOTE field.
FieldRef3 Specifies the REF field.
FieldRefNoKeyword2 Specifies that the field represents a REF field where the keyword has been omitted.
FieldRefDoc11 Specifies the RD field.
FieldRevisionNum24 Specifies the REVNUM field.
FieldSaveDate22 Specifies the SAVEDATE field.
FieldSection65 Specifies the SECTION field.
FieldSectionPages66 Specifies the SECTIONPAGES field.
FieldSequence12 Specifies the SEQ field.
FieldSet6 Specifies the SET field.
FieldShape95 Specifies the SHAPE field.
FieldSkipIf43 Specifies the SKIPIF field.
FieldStyleRef10 Specifies the STYLEREF field.
FieldSubject16 Specifies the SUBJECT field.
FieldSymbol57 Specifies the SYMBOL field.
FieldTemplate30 Specifies the TEMPLATE field.
FieldTime32 Specifies the TIME field.
FieldTitle15 Specifies the TITLE field.
FieldTOA73 Specifies the TOA field.
FieldTOAEntry74 Specifies the TA field.
FieldTOC13 Specifies the TOC field.
FieldTOCEntry9 Specifies the TC field.
FieldUserAddress62 Specifies the USERADDRESS field.
FieldUserInitials61 Specifies the USERINITIALS field.
FieldUserName60 Specifies the USERNAME field.
Examples
Demonstrates how to retrieve the field class from an existing FieldStart node in the document.
Document doc = new Document(MyDir + "Document.TableOfContents.doc");

FieldChar fieldStart = (FieldChar)doc.GetChild(NodeType.FieldStart, 0, true);
Assert.AreEqual(FieldType.FieldTOC, fieldStart.FieldType);
Assert.AreEqual(true, fieldStart.IsDirty);
Assert.AreEqual(false, fieldStart.IsLocked);

// Retrieve the facade object which represents the field in the document.
Field field = fieldStart.GetField();

Assert.AreEqual(false, field.IsLocked);
Assert.AreEqual(" TOC \\o \"1-3\" \\h \\z \\u ", field.GetFieldCode());

// This updates only this field in the document.
field.Update();
Examples
Inserts a field into a document using DocumentBuilder and FieldCode.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert a simple Date field into the document.
// When we insert a field through the DocumentBuilder class we can get the
// special Field object which contains information about the field.
Field dateField = builder.InsertField(@"DATE \* MERGEFORMAT");

// Update this particular field in the document so we can get the FieldResult.
dateField.Update();

// Display some information from this field.
// The field result is where the last evaluated value is stored. This is what is displayed in the document
// When field codes are not showing.
Console.WriteLine("FieldResult: {0}", dateField.Result);

// Display the field code which defines the behavior of the field. This can been seen in Microsoft Word by pressing ALT+F9.
Console.WriteLine("FieldCode: {0}", dateField.GetFieldCode());

// The field type defines what type of field in the Document this is. In this case the type is "FieldDate" 
Console.WriteLine("FieldType: {0}", dateField.Type);

// Finally let's completely remove the field from the document. This can easily be done by invoking the Remove method on the object.
dateField.Remove();
See Also