Hi guys, I'm trying to achieve the following:
I'm working on a script which loops through elements of a structured document and changes the <TEXT> content of certain elements. The script is running fine for the looping part: I can output the element names to console and identify the elements of which content I wish to change.
The problem is that I can't figure out how to change the actual content of the <TEXT> and I can't find the information anywhere so I figured I'd try the forum.
What methods / functions should I use to change the text content of an element?
Let's say I've got my element on a variable "elem" and start from there...
Thanks for your help in advance, it would be great if you could point me to the right direction!
Don't know if you are still struggling with this. There are a couple of catches when going back and forth between elements and text. To get access to the text of an element, you use the GetText method on the element. This gives you a TextItems array, which you should be able to handle. There is also the conversion between element locations and text locations, which you may need at some point. These are available for the Doc object: ElementLocToTextLoc and TextLocToElementLoc.