次の方法で共有


Word.SelectionNextOptions interface

Selection.next メソッドのオプションを表します。

注釈

[ API set: WordApiDesktop 1.4 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/55-selection/get-previous-next-range.yaml

// Gets the range of the next word relative to the current selection.
await Word.run(async (context) => {
  const options: Word.SelectionNextOptions = {
    unit: Word.OperationUnit.word,
    count: 1,
  };
  const nextRange: Word.Range = context.document.selection.getNextRange(options);
  nextRange.load("text");
  await context.sync();

  console.log(`Next word: "${nextRange.text}"`);
});

プロパティ

count

指定した場合は、先に進む単位の数を指定します。 既定値は 1 です。

unit

指定した場合は、選択範囲を移動する単位の種類を指定します。 既定値は characterです。

プロパティの詳細

count

指定した場合は、先に進む単位の数を指定します。 既定値は 1 です。

count?: number;

プロパティ値

number

注釈

[ API set: WordApiDesktop 1.4 ]

unit

指定した場合は、選択範囲を移動する単位の種類を指定します。 既定値は characterです。

unit?: Word.OperationUnit | "Character" | "Word" | "Sentence" | "Paragraph" | "Line" | "Story" | "Screen" | "Section" | "Column" | "Row" | "Window" | "Cell" | "CharacterFormat" | "ParagraphFormat" | "Table" | "Item";

プロパティ値

Word.OperationUnit | "Character" | "Word" | "Sentence" | "Paragraph" | "Line" | "Story" | "Screen" | "Section" | "Column" | "Row" | "Window" | "Cell" | "CharacterFormat" | "ParagraphFormat" | "Table" | "Item"

注釈

[ API set: WordApiDesktop 1.4 ]