Copy link to clipboard
Copied
Hello again,
How do I get to an element from a text location ? As my document is structured I am always in an element, but there does not seem to be a way to get there easily. I tried doc.ElementSelection but that just gives me ivalid elements.
Thanks for any pointer in the right direction
Jang
Copy link to clipboard
Copied
Hi Jang,
Did you end up working this out? I'm trying to do the same thing now and looking for the answer....
thanks,
Tracey
Copy link to clipboard
Copied
Hi Tracey,
It turned out to be really simple: you can translate between text locations and element locations using two methods (one for each direction).
var oTRange = oDoc.TextSelection;
var oTLoc = oTRange.beg; /* beg and end are two TLoc objects, which will be the same
if no text is selected */
var oELoc = oDoc.TextLocToElementLoc( TLoc );
Kind regards
Jang