how can I get Word.Section Range using office javascript api?

45 Views Asked by At

I want to get current Word Section range. where my cursor is clicked get there section rage.

this is like of Microsoft documentation

Word.Section class

1

There are 1 best solutions below

3
Rick Kirkham On BEST ANSWER

Try using document.getSelection() to get the range where the cursor is. Then on that range object, call Range.parentBody. This will give you the body of the section that the cursor is in. Then on that body object use Body.getRange("Whole") to get the range of the whole section body.