getTextSelection() not returning the selected range
We have an empty element "endReusableBlock" that only has one attribute "id". It is styled as a block, with its text hidden and we add some gentext after it.
If we select a block that ends with the hidden element:
And use Application.ActiveDocument.getTextSelection() to get the selected text, the function doesn't return the hidden element in the range. If I change the styling of the element and make it non hidden. The function "getTextSelection()" returns is in the range.
I'm glad it worked for you. However, I just realized I did make one mistake there: in the last line, the hidesuppressed option should be set back to the value we stored previously in the variable "hidden", instead of just setting it to "on". So the last line should look like this:
That way, if a user has turned that option off via the Preferences panel, you won't end up turning it back on for them without their knowing it. It simply will simply restore the setting to its previous state.