Word.FieldKind enum

表示字段的类型。 指示字段与更新相关的工作原理。

注解

[ API 集:WordApi 1.5 ]

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/50-document/manage-fields.yaml

// Gets the first field in the document.
await Word.run(async (context) => {
  const field = context.document.body.fields.getFirstOrNullObject();
  field.load(["code", "result", "locked", "type", "data", "kind"]);

  await context.sync();

  if (field.isNullObject) {
    console.log("This document has no fields.");
  } else {
    console.log("Code of first field: " + field.code, "Result of first field: " + JSON.stringify(field.result), "Type of first field: " + field.type, "Is the first field locked? " + field.locked, "Kind of the first field: " + field.kind);
  }
});

字段

cold = "Cold"

表示字段没有结果。

hot = "Hot"

表示字段在每次显示或每次重新格式化页面时自动更新,但也可以手动更新。

none = "None"

表示字段无效。 例如,一对不带任何内容的字段字符。

warm = "Warm"

表示当源更改或可以手动更新字段时,字段会自动更新。