1 Reply Latest reply on Jun 30, 2009 6:04 AM by Andrewdev

    How to place tagged text not from file?




      I'm using InDesign Server CS4 with the Java API and wonder if it is possible to place tagged text into a text frame NOT from a file but e.g. from a String containing the tagged text? The only method in the API I could find to place tagged text is TextFrame#place(String) which takes the path to the text file as paramter. Is there any other way to place tagged text not by importing a text file?


      Best Regards,


        • 1. Re: How to place tagged text not from file?
          Andrewdev Level 1

          I am not familiar with JAVA API, but you should be able to execute JSX scripts.

          So in JSX you can set and read your tagged text elements in this way:


          // set new text values into array

          taggedElements['myText'] = 'text text text...';

          taggedElements['myText2'] = 'text text text...';


          var textFrames = document.textFrames;
          for(textFrameNum = 0; textFrameNum < textFrames.length; textFrameNum++) {

               if(textFrames[textFrameNum].associatedXMLElement != null) {

                    var elementName = textFrames[textFrameNum].associatedXMLElement.markupTag.name;

                    textFrames[textFrameNum].paragraphs.item(0).contents = taggedElements[elementName ];




          I have not checked properly this code, there could be a typo!