Word.OperationUnit enum
Specifies the unit of measurement used in Word operations.
Remarks
[ API set: WordApiDesktop 1.4 ]
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. |