Word.CompareTarget enum

注意

此 API 以预览状态提供给开发者,可能根据我们收到的反馈更改。 请勿在生产环境中使用此 API。

指定用于显示文档比较结果差异的目标文档。

注解

[ API 集:WordApi BETA (仅预览版) ]

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/compare-documents.yaml

// Compares the current document with a specified external document.
await Word.run(async (context) => {
  // Absolute path of an online or local document.
  const filePath = $("#filePath")
    .val()
    .toString();
  // Options that configure the compare operation.
  const options = {
    compareTarget: Word.CompareTarget.compareTargetCurrent,
    detectFormatChanges: false
    // Other options you choose...
    };
  context.document.compare(filePath, options);

  await context.sync();

  console.log("Differences shown in the current document.");
});

字段

compareTargetCurrent = "CompareTargetCurrent"

Places当前文档中的比较差异。

compareTargetNew = "CompareTargetNew"

将比较结果差异置于新文档中。

compareTargetSelected = "CompareTargetSelected"

将比较结果差异置于目标文档中。