Word.SelectionMode enum

表示在文档中选择后设置光标 (插入点) 的位置。

注解

API 集:WordApi 1.1

使用方

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/35-ranges/scroll-to-range.yaml

// Moves the insertion point to the end of the final paragraph.
await Word.run(async (context) => {
  const lastRange: Word.Range = context.document.body.paragraphs.getLast().getRange();
  const selectionMode: Word.SelectionMode = Word.SelectionMode.end;
  lastRange.select(selectionMode);

  await context.sync();
});

字段

end = "End"

光标位于所选内容的末尾 (就在所选区域) 的末尾之后。

select = "Select"

将选中整个范围。

start = "Start"

光标位于所选区域 (的开头,就在所选区域) 的开始之前。