Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Word.OperationUnit enum
- Package:
- word
Specifies the unit of measurement used in Word operations.
Remarks
Used by
- Word.Selection: expand, extend
- Word.SelectionDeleteOptions: unit
- Word.SelectionMoveLeftRightOptions: unit
- Word.SelectionMoveOptions: unit
- Word.SelectionMoveStartEndOptions: unit
- Word.SelectionMoveUpDownOptions: unit
- Word.SelectionNextOptions: unit
- Word.SelectionPreviousOptions: unit
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}"`);
});
Fields
| cell = "Cell" | Specifies a cell unit. |
| character = "Character" | Specifies a character unit. |
| characterFormat = "CharacterFormat" | Specifies a character format unit. |
| column = "Column" | Specifies a column unit. |
| item = "Item" | Specifies an item unit. |
| line = "Line" | Specifies a line unit. |
| paragraph = "Paragraph" | Specifies a paragraph unit. |
| paragraphFormat = "ParagraphFormat" | Specifies a paragraph format unit. |
| row = "Row" | Specifies a row unit. |
| screen = "Screen" | Specifies a screen unit. |
| section = "Section" | Specifies a section unit. |
| sentence = "Sentence" | Specifies a sentence unit. |
| story = "Story" | Specifies a story unit. |
| table = "Table" | Specifies a table unit. |
| window = "Window" | Specifies a window unit. |
| word = "Word" | Specifies a word unit. |
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Add-ins
Feedback
Was this page helpful?
