Word.FieldType enum
表示Word的类型。Field 对象。
注解
示例
// 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));
}
});
字段
| addin = "Addin" | 表示字段类型为 Add-in。 |
| addressBlock = "AddressBlock" | 表示字段类型为 AddressBlock。 |
| advance = "Advance" | 表示字段类型为“高级”。 |
| ask = "Ask" | 表示字段类型为 Ask。 |
| author = "Author" | 表示字段类型为 Author。 |
| autoText = "AutoText" | 表示字段类型为“自动图文集”。 |
| autoTextList = "AutoTextList" | 表示字段类型为 AutoTextList。 |
| barCode = "BarCode" | 表示字段类型为 Barcode。 |
| bibliography = "Bibliography" | 表示字段类型为书目。 |
| bidiOutline = "BidiOutline" | 表示字段类型为 BidiOutline。 |
| citation = "Citation" | 表示字段类型为“引文”。 |
| comments = "Comments" | 表示字段类型为“注释”。 |
| compare = "Compare" | 表示字段类型为 Compare。 |
| createDate = "CreateDate" | 表示字段类型为 CreateDate。 |
| data = "Data" | 表示字段类型为 Data。 |
| database = "Database" | 表示字段类型为“数据库”。 |
| date = "Date" | 表示字段类型为 Date。 |
| displayBarcode = "DisplayBarcode" | 表示字段类型为 DisplayBarcode。 |
| docProperty = "DocProperty" | 表示字段类型为 DocumentProperty |
| docVariable = "DocVariable" | 表示字段类型为 DocumentVariable。 |
| editTime = "EditTime" | 表示字段类型为 EditTime。 |
| embedded = "Embedded" | 表示字段类型为 Embedded。 |
| empty = "Empty" | 表示字段类型为空。 |
| eq = "EQ" | 表示字段类型为“公式”。 |
| expression = "Expression" | 表示字段类型为 Expression。 |
| fileName = "FileName" | 表示字段类型为 FileName。 |
| fileSize = "FileSize" | 表示字段类型为 FileSize。 |
| fillIn = "FillIn" | 表示字段类型为 FillIn。 |
| formCheckbox = "FormCheckbox" | 表示字段类型为 FormCheckbox。 |
| formDropdown = "FormDropdown" | 表示字段类型为 FormDropdown。 |
| formText = "FormText" | 表示字段类型为 FormText。 |
| gotoButton = "GotoButton" | 表示字段类型为 GotoButton。 |
| greetingLine = "GreetingLine" | 表示字段类型为 GreetingLine。 |
| hyperlink = "Hyperlink" | 表示字段类型为 Hyperlink。 |
| if = "If" | 表示字段类型为 If。 |
| import = "Import" | 表示字段类型为 Import。 |
| include = "Include" | 表示字段类型为 Include。 |
| includePicture = "IncludePicture" | 表示字段类型为 IncludePicture。 |
| includeText = "IncludeText" | 表示字段类型为 IncludeText。 |
| index = "Index" | 表示字段类型为 Index。 |
| info = "Info" | 表示字段类型为 Information。 |
| keywords = "Keywords" | 表示字段类型为 Keywords。 |
| lastSavedBy = "LastSavedBy" | 表示字段类型为 LastSavedBy。 |
| link = "Link" | 表示字段类型为 Link。 |
| listNum = "ListNum" | 表示字段类型为 ListNumber。 |
| macroButton = "MacroButton" | 表示字段类型为 MacroButton。 |
| mergeBarcode = "MergeBarcode" | 表示字段类型为 MergeBarcode。 |
| mergeField = "MergeField" | 表示字段类型为 MergeField。 |
| mergeRec = "MergeRec" | 表示字段类型为 MergeRecord。 |
| mergeSeq = "MergeSeq" | 表示字段类型为 MergeSequence。 |
| next = "Next" | 表示字段类型为 Next。 |
| nextIf = "NextIf" | 表示字段类型为 NextIf。 |
| noteRef = "NoteRef" | 表示字段类型为 NoteReference。 |
| numChars = "NumChars" | 表示字段类型为 NumberOfCharacters。 |
| numPages = "NumPages" | 表示字段类型为 NumberOfPages。 |
| numWords = "NumWords" | 表示字段类型为 NumberOfWords。 |
| ocx = "OCX" | 表示字段类型为 ActiveXControl。 |
| others = "Others" | 表示 Office JavaScript API 不支持的字段类型。 |
| page = "Page" | 表示字段类型为 Page。 |
| pageRef = "PageRef" | 表示字段类型为 PageReference。 |
| print = "Print" | 表示字段类型为 Print。 |
| printDate = "PrintDate" | 表示字段类型为 PrintDate。 |
| private = "Private" | 表示字段类型为 Private。 |
| quote = "Quote" | 表示字段类型为 Quote。 |
| rd = "RD" | 表示字段类型为 ReferencedDocument。 |
| ref = "Ref" | 表示字段类型为 Reference。 |
| revNum = "RevNum" | 表示字段类型为 RevisionNumber。 |
| saveDate = "SaveDate" | 表示字段类型为 SaveDate。 |
| section = "Section" | 表示字段类型为 Section。 |
| sectionPages = "SectionPages" | 表示字段类型为 SectionPages。 |
| seq = "Seq" | 表示字段类型为 Sequence。 |
| set = "Set" | 表示字段类型为 Set。 |
| shape = "Shape" | 表示字段类型为 Shape。 |
| skipIf = "SkipIf" | 表示字段类型为 SkipIf。 |
| styleRef = "StyleRef" | 表示字段类型为 StyleReference。 |
| subject = "Subject" | 表示字段类型为 Subject。 |
| subscriber = "Subscriber" | 表示字段类型为订阅服务器。 |
| symbol = "Symbol" | 表示字段类型为 Symbol。 |
| ta = "TA" | 表示字段类型为 TableOfAuthoritiesEntry。 |
| tc = "TC" | 表示字段类型为 TableOfContentsEntry。 |
| template = "Template" | 表示字段类型为 Template。 |
| time = "Time" | 表示字段类型为“时间”。 |
| title = "Title" | 表示字段类型为 Title。 |
| toa = "TOA" | 表示字段类型为 TableOfAuthorities。 |
| toc = "TOC" | 表示字段类型为 TableOfContents。 |
| undefined = "Undefined" | 表示字段类型为“未定义”。 |
| userAddress = "UserAddress" | 表示字段类型为 UserAddress。 |
| userInitials = "UserInitials" | 表示字段类型为 UserInitials。 |
| userName = "UserName" | 表示字段类型为 UserName。 |
| xe = "XE" | 表示字段类型为 IndexEntry。 |