nlid's avatar
nlid
Brass Contributor
Jul 29, 2025
Status:
New

Support for Retrieving Multiple Selected Ranges in Word via Office.js

Request Summary:
Please add support in the Office.js API for retrieving multiple non-contiguous selections in Word documents, such as those created using Ctrl + click (multi-range selection). This is currently not possible through existing API calls.

Issue Detail:
In Word, users can hold down the Ctrl key and use the mouse to select multiple non-contiguous ranges of text—for example, paragraphs 1, 3, and 5 in a document. Visually, Word correctly highlights all selected regions.

However, the current Office.js API, specifically the context.document.getSelection() method, only returns the most recent (or final) selected range. In the example above, it would return only the content of paragraph 5, making it impossible to access the full scope of the user’s actual selection.

Impact:
This limitation hinders the ability to build rich, selection-aware add-ins that need to act on all selected content—not just the last selected range. Scenarios like batch formatting, multi-range content analysis, or custom processing of user-selected segments are currently not feasible.

Proposed Enhancement:
Introduce a method such as context.document.getSelections() or extend the existing API to return a Word.RangeCollection that includes all currently selected ranges. This would enable developers to accurately reflect and respond to the user’s full intent in multi-range selections.

Conclusion:
Enabling access to multiple selected ranges would greatly improve the fidelity and usefulness of Word-based add-ins and unlock new, powerful document interaction scenarios for developers.

No CommentsBe the first to comment