Forum Discussion
Office.js: Is there any supported way to retrieve multiple non-contiguous text selections in Word?
Select the first block of text and then while holding down the CTRL key, left click and drag from the beginning to the end of any subsequent blocks of text that you want to select. Below is a screen shot of that application of that procedure:
In the case of multiple words, instead of left clicking and dragging with the CTRL key held down, you can double left click with the mouse with the CTRL key held down and likewise for selecting a complete paragraph, you can triple left click with the mouse.
- nitika-optimusJul 23, 2026Copper Contributor
Thank you for your response and for explaining how multiple non-contiguous selections can be made in Word.
My question is specifically about the Office.js API, rather than how users create the selection in the Word UI.
I understand that Word supports multiple selections using Ctrl + click/drag. However, when my add-in calls:
context.document.getSelection()
it only returns a single Word.Range.
Is there any supported Office.js API to retrieve all of the selected ranges, or to detect that the current selection consists of multiple non-contiguous ranges?