Skip navigation
sahokkan003
Currently Being Moderated

Changing <TEXT> content of element via ExtendScript?

Apr 26, 2012 7:03 AM

Tags: #elements #javascript #framemaker10 #extendscript #looping #tutorial #structured_framemaker

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!

 
Replies
  • Currently Being Moderated
    May 28, 2012 3:55 AM   in reply to sahokkan003

    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.

     

    Good luck

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points