Word.FieldType enum
Represents the type of Word.Field object.
Remarks
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/50-document/manage-fields.yaml
// Inserts a Date field before selection.
await Word.run(async (context) => {
const range: Word.Range = context.document.getSelection().getRange();
const field: Word.Field = range.insertField(Word.InsertLocation.before, Word.FieldType.date, '\\@ "M/d/yyyy h:mm am/pm"', true);
field.load("result,code");
await context.sync();
if (field.isNullObject) {
console.log("There are no fields in this document.");
} else {
console.log("Code of the field: " + field.code, "Result of the field: " + JSON.stringify(field.result));
}
});
Fields
| addin = "Addin" | Represents that the field type is Add-in. |
| addressBlock = "AddressBlock" | Represents that the field type is AddressBlock. |
| advance = "Advance" | Represents that the field type is Advance. |
| ask = "Ask" | Represents that the field type is Ask. |
| author = "Author" | Represents that the field type is Author. |
| autoText = "AutoText" | Represents that the field type is AutoText. |
| autoTextList = "AutoTextList" | Represents that the field type is AutoTextList. |
| barCode = "BarCode" | Represents that the field type is Barcode. |
| bibliography = "Bibliography" | Represents that the field type is Bibliography. |
| bidiOutline = "BidiOutline" | Represents that the field type is BidiOutline. |
| citation = "Citation" | Represents that the field type is Citation. |
| comments = "Comments" | Represents that the field type is Comments. |
| compare = "Compare" | Represents that the field type is Compare. |
| createDate = "CreateDate" | Represents that the field type is CreateDate. |
| data = "Data" | Represents that the field type is Data. |
| database = "Database" | Represents that the field type is Database. |
| date = "Date" | Represents that the field type is Date. |
| displayBarcode = "DisplayBarcode" | Represents that the field type is DisplayBarcode. |
| docProperty = "DocProperty" | Represents that the field type is DocumentProperty |
| docVariable = "DocVariable" | Represents that the field type is DocumentVariable. |
| editTime = "EditTime" | Represents that the field type is EditTime. |
| embedded = "Embedded" | Represents that the field type is Embedded. |
| empty = "Empty" | Represents that the field type is Empty. |
| eq = "EQ" | Represents that the field type is Equation. |
| expression = "Expression" | Represents that the field type is Expression. |
| fileName = "FileName" | Represents that the field type is FileName. |
| fileSize = "FileSize" | Represents that the field type is FileSize. |
| fillIn = "FillIn" | Represents that the field type is FillIn. |
| formCheckbox = "FormCheckbox" | Represents that the field type is FormCheckbox. |
| formDropdown = "FormDropdown" | Represents that the field type is FormDropdown. |
| formText = "FormText" | Represents that the field type is FormText. |
| gotoButton = "GotoButton" | Represents that the field type is GotoButton. |
| greetingLine = "GreetingLine" | Represents that the field type is GreetingLine. |
| hyperlink = "Hyperlink" | Represents that the field type is Hyperlink. |
| if = "If" | Represents that the field type is If. |
| import = "Import" | Represents that the field type is Import. |
| include = "Include" | Represents that the field type is Include. |
| includePicture = "IncludePicture" | Represents that the field type is IncludePicture. |
| includeText = "IncludeText" | Represents that the field type is IncludeText. |
| index = "Index" | Represents that the field type is Index. |
| info = "Info" | Represents that the field type is Information. |
| keywords = "Keywords" | Represents that the field type is Keywords. |
| lastSavedBy = "LastSavedBy" | Represents that the field type is LastSavedBy. |
| link = "Link" | Represents that the field type is Link. |
| listNum = "ListNum" | Represents that the field type is ListNumber. |
| macroButton = "MacroButton" | Represents that the field type is MacroButton. |
| mergeBarcode = "MergeBarcode" | Represents that the field type is MergeBarcode. |
| mergeField = "MergeField" | Represents that the field type is MergeField. |
| mergeRec = "MergeRec" | Represents that the field type is MergeRecord. |
| mergeSeq = "MergeSeq" | Represents that the field type is MergeSequence. |
| next = "Next" | Represents that the field type is Next. |
| nextIf = "NextIf" | Represents that the field type is NextIf. |
| noteRef = "NoteRef" | Represents that the field type is NoteReference. |
| numChars = "NumChars" | Represents that the field type is NumberOfCharacters. |
| numPages = "NumPages" | Represents that the field type is NumberOfPages. |
| numWords = "NumWords" | Represents that the field type is NumberOfWords. |
| ocx = "OCX" | Represents that the field type is ActiveXControl. |
| others = "Others" | Represents the field types not supported by the Office JavaScript API. |
| page = "Page" | Represents that the field type is Page. |
| pageRef = "PageRef" | Represents that the field type is PageReference. |
| print = "Print" | Represents that the field type is Print. |
| printDate = "PrintDate" | Represents that the field type is PrintDate. |
| private = "Private" | Represents that the field type is Private. |
| quote = "Quote" | Represents that the field type is Quote. |
| rd = "RD" | Represents that the field type is ReferencedDocument. |
| ref = "Ref" | Represents that the field type is Reference. |
| revNum = "RevNum" | Represents that the field type is RevisionNumber. |
| saveDate = "SaveDate" | Represents that the field type is SaveDate. |
| section = "Section" | Represents that the field type is Section. |
| sectionPages = "SectionPages" | Represents that the field type is SectionPages. |
| seq = "Seq" | Represents that the field type is Sequence. |
| set = "Set" | Represents that the field type is Set. |
| shape = "Shape" | Represents that the field type is Shape. |
| skipIf = "SkipIf" | Represents that the field type is SkipIf. |
| styleRef = "StyleRef" | Represents that the field type is StyleReference. |
| subject = "Subject" | Represents that the field type is Subject. |
| subscriber = "Subscriber" | Represents that the field type is Subscriber. |
| symbol = "Symbol" | Represents that the field type is Symbol. |
| ta = "TA" | Represents that the field type is TableOfAuthoritiesEntry. |
| tc = "TC" | Represents that the field type is TableOfContentsEntry. |
| template = "Template" | Represents that the field type is Template. |
| time = "Time" | Represents that the field type is Time. |
| title = "Title" | Represents that the field type is Title. |
| toa = "TOA" | Represents that the field type is TableOfAuthorities. |
| toc = "TOC" | Represents that the field type is TableOfContents. |
| undefined = "Undefined" | Represents that the field type is Undefined. |
| userAddress = "UserAddress" | Represents that the field type is UserAddress. |
| userInitials = "UserInitials" | Represents that the field type is UserInitials. |
| userName = "UserName" | Represents that the field type is UserName. |
| xe = "XE" | Represents that the field type is IndexEntry. |