Word.Critique interface

将为文档中段落的指定部分呈现为下划线的批评。

注解

[ API 集:WordApi 1.7 ]

示例

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

// Adds annotations to the selected paragraph.
await Word.run(async (context) => {
  const paragraph = context.document.getSelection().paragraphs.getFirst();
  const critique1 = {
    colorScheme: Word.CritiqueColorScheme.red,
    start: 1,
    length: 3
  };
  const critique2 = {
    colorScheme: Word.CritiqueColorScheme.green,
    start: 6,
    length: 1
  };
  const critique3 = {
    colorScheme: Word.CritiqueColorScheme.blue,
    start: 10,
    length: 3
  };
  const critique4 = {
    colorScheme: Word.CritiqueColorScheme.lavender,
    start: 14,
    length: 3
  };
  const critique5 = {
    colorScheme: Word.CritiqueColorScheme.berry,
    start: 18,
    length: 10
  };
  const annotationSet: Word.AnnotationSet = {
    critiques: [critique1, critique2, critique3, critique4, critique5]
  };

  const annotationIds = paragraph.insertAnnotations(annotationSet);

  await context.sync();

  console.log("Annotations inserted:", annotationIds.value);
});

属性

colorScheme

获取批评的配色方案。

length

获取段落内批评的长度。

popupOptions

指定批评弹出菜单的行为。

start

获取段落内批评的起始索引。

属性详细信息

colorScheme

获取批评的配色方案。

colorScheme: Word.CritiqueColorScheme | "Red" | "Green" | "Blue" | "Lavender" | "Berry";

属性值

Word.CritiqueColorScheme | "Red" | "Green" | "Blue" | "Lavender" | "Berry"

注解

[ API 集:WordApi 1.7 ]

length

获取段落内批评的长度。

length: number;

属性值

number

注解

[ API 集:WordApi 1.7 ]

popupOptions

注意

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

指定批评弹出菜单的行为。

popupOptions: Word.CritiquePopupOptions;

属性值

注解

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

start

获取段落内批评的起始索引。

start: number;

属性值

number

注解

[ API 集:WordApi 1.7 ]