Word.SelectionPreviousOptions interface
Представляет параметры метода Selection.getPreviousRange .
Комментарии
Используется
Примеры
// 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 previous word relative to the current selection.
await Word.run(async (context) => {
const options: Word.SelectionPreviousOptions = {
unit: Word.OperationUnit.word,
count: 1,
};
const previousRange: Word.Range = context.document.selection.getPreviousRange(options);
previousRange.load("text");
await context.sync();
console.log(`Previous word: "${previousRange.text}"`);
});
Свойства
| count | Если указано, указывает количество единиц, на которое требуется переместиться. Значение по умолчанию равно 1. |
| unit | Если указано, указывает тип единицы, на которую нужно переместить выделенный фрагмент. Значение по умолчанию: |
Сведения о свойстве
count
Если указано, указывает количество единиц, на которое требуется переместиться. Значение по умолчанию равно 1.
count?: number;
Значение свойства
number
Комментарии
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"