FieldType enumeration

Specifies Microsoft Word field types.

public enum FieldType


FieldNone0Field type is not specified or unknown.
FieldCannotParse1Specifies that the field was unable to be parsed.
FieldAddin81Specifies the ADDIN field.
FieldAddressBlock93Specifies the ADDRESSBLOCK field.
FieldAdvance84Specifies the ADVANCE field.
FieldAsk38Specifies the ASK field.
FieldAuthor17Specifies the AUTHOR field.
FieldAutoNum54Specifies the AUTONUM field.
FieldAutoNumLegal53Specifies the AUTONUMLGL field.
FieldAutoNumOutline52Specifies the AUTONUMOUT field.
FieldAutoText79Specifies the AUTOTEXT field.
FieldAutoTextList89Specifies the AUTOTEXTLIST field.
FieldBarcode63Specifies the BARCODE field.
FieldBibliography100500Specifies the BIBLIOGRAPHY field.
FieldBidiOutline92Specifies the BIDIOUTLINE field.
FieldCitation1980Specifies the CITATION field.
FieldComments19Specifies the COMMENTS field.
FieldCompare80Specifies the COMPARE field.
FieldCreateDate21Specifies the CREATEDATE field.
FieldData40Specifies the DATA field.
FieldDatabase78Specifies the DATABASE field.
FieldDate31Specifies the DATE field.
FieldDDE45Specifies the DDE field.
FieldDisplayBarcode6301Specifies the DISPLAYBARCODE field.
FieldMergeBarcode6302Specifies the MERGEBARCODE field.
FieldDDEAuto46Specifies the DDEAUTO field.
FieldDocProperty85Specifies the DOCPROPERTY field.
FieldDocVariable64Specifies the DOCVARIABLE field.
FieldEditTime25Specifies the EDITTIME field.
FieldEmbed58Specifies the EMBED field.
FieldEquation49Specifies the EQ field.
FieldFileName29Specifies the FILENAME field.
FieldFileSize69Specifies the FILESIZE field.
FieldFillIn39Specifies the FILLIN field.
FieldFootnoteRef5Specifies the FOOTNOTEREF field.
FieldFormCheckBox71Specifies the FORMCHECKBOX field.
FieldFormDropDown83Specifies the FORMDROPDOWN field.
FieldFormTextInput70Specifies the FORMTEXT field.
FieldFormula34Specifies the = (formula) field.
FieldGreetingLine94Specifies the GREETINGLINE field.
FieldGlossary47Specifies the GLOSSARY field.
FieldGoToButton50Specifies the GOTOBUTTON field.
FieldHtmlActiveX91Specifies the field that represents an HTML control.
FieldHyperlink88Specifies the HYPERLINK field.
FieldIf7Specifies the IF field.
FieldInclude36Specifies the INCLUDE field.
FieldIncludePicture67Specifies the INCLUDEPICTURE field.
FieldIncludeText68Specifies the INCLUDETEXT field.
FieldIndex8Specifies the INDEX field.
FieldIndexEntry4Specifies the XE field.
FieldInfo14Specifies the INFO field.
FieldImport55Specifies the IMPORT field.
FieldKeyword18Specifies the KEYWORDS field.
FieldLastSavedBy20Specifies the LASTSAVEDBY field.
FieldLink56Specifies the LINK field.
FieldListNum90Specifies the LISTNUM field.
FieldMacroButton51Specifies the MACROBUTTON field.
FieldMergeField59Specifies the MERGEFIELD field.
FieldMergeRec44Specifies the MERGEREC field.
FieldMergeSeq75Specifies the MERGESEQ field.
FieldNext41Specifies the NEXT field.
FieldNextIf42Specifies the NEXTIF field.
FieldNoteRef72Specifies the NOTEREF field.
FieldNumChars28Specifies the NUMCHARS field.
FieldNumPages26Specifies the NUMPAGES field.
FieldNumWords27Specifies the NUMWORDS field.
FieldOcx87Specifies the OCX field.
FieldPage33Specifies the PAGE field.
FieldPageRef37Specifies the PAGEREF field.
FieldPrint48Specifies the PRINT field.
FieldPrintDate23Specifies the PRINTDATE field.
FieldPrivate77Specifies the PRIVATE field.
FieldQuote35Specifies the QUOTE field.
FieldRef3Specifies the REF field.
FieldRefNoKeyword2Specifies that the field represents a REF field where the keyword has been omitted.
FieldRefDoc11Specifies the RD field.
FieldRevisionNum24Specifies the REVNUM field.
FieldSaveDate22Specifies the SAVEDATE field.
FieldSection65Specifies the SECTION field.
FieldSectionPages66Specifies the SECTIONPAGES field.
FieldSequence12Specifies the SEQ field.
FieldSet6Specifies the SET field.
FieldShape95Specifies the SHAPE field.
FieldSkipIf43Specifies the SKIPIF field.
FieldStyleRef10Specifies the STYLEREF field.
FieldSubject16Specifies the SUBJECT field.
FieldSymbol57Specifies the SYMBOL field.
FieldTemplate30Specifies the TEMPLATE field.
FieldTime32Specifies the TIME field.
FieldTitle15Specifies the TITLE field.
FieldTOA73Specifies the TOA field.
FieldTOAEntry74Specifies the TA field.
FieldTOC13Specifies the TOC field.
FieldTOCEntry9Specifies the TC field.
FieldUserAddress62Specifies the USERADDRESS field.
FieldUserInitials61Specifies the USERINITIALS field.
FieldUserName60Specifies the USERNAME field.


Shows how to insert a field into a document using a field code.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Field field = builder.InsertField("DATE \\@ \"dddd, MMMM dd, yyyy\"");

Assert.AreEqual(FieldType.FieldDate, field.Type);
Assert.AreEqual("DATE \\@ \"dddd, MMMM dd, yyyy\"", field.GetFieldCode());

// This overload of the InsertField method automatically updates inserted fields.
Assert.That(DateTime.Parse(field.Result), Is.EqualTo(DateTime.Today).Within(1).Days);

Shows how to work with a FieldStart node.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

FieldDate field = (FieldDate)builder.InsertField(FieldType.FieldDate, true);
field.Format.DateTimeFormat = "dddd, MMMM dd, yyyy";

FieldChar fieldStart = field.Start;

Assert.AreEqual(FieldType.FieldDate, fieldStart.FieldType);
Assert.AreEqual(false, fieldStart.IsDirty);
Assert.AreEqual(false, fieldStart.IsLocked);

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

Assert.AreEqual(false, field.IsLocked);
Assert.AreEqual(" DATE  \\@ \"dddd, MMMM dd, yyyy\"", field.GetFieldCode());

// Update the field to show the current date.

See Also