Edit

Word.SelectionNextOptions interface

Represents the options for the Selection.getNextRange method.

Remarks

API set: WordApiDesktop 1.4

Used by

Examples

// 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}"`);
});

Properties

count

If provided, specifies the number of units by which you want to move ahead. The default value is 1.

unit

If provided, specifies the type of units by which to move the selection. The default value is character.

Property Details

count

If provided, specifies the number of units by which you want to move ahead. The default value is 1.

count?: number;

Property Value

number

Remarks

API set: WordApiDesktop 1.4

unit

If provided, specifies the type of units by which to move the selection. The default value is character.

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

Property Value

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

Remarks

API set: WordApiDesktop 1.4