2 Replies Latest reply on Jun 30, 2011 10:55 PM by Bal_Glen

    Copy text with styleinformation

    Bal_Glen

      Hello,

       

      I'm working in Indesign CS5 with javascript.


      The problem:

      I want to replace the parentStory of linked textFrames with the content of a newly generated Table Of Contents (which is a Story). After which I can delete the newly generated Table Of Contents.

      Why not just updating the Table of Contents? Simple, when making a Table Of Contents of a tocStyle which is not in the document, i get a new TOC in a new textFrame. I only need 1 TOC, but the tocStyle can change, so it' not quite an update. (If someone has an idea to solve this issue, that's fine too.)

       

      My firsts thoughts went to put the story of the textFrame I need to replace in oldStory and just do it with contents: oldStory.content = newStory.contents;

      But when I copied contents I lost all style information. All paragraphs have the same style and i lost the characterstyles.

       

      Maybe my mind has a bad day, but I don't seem to be able to copy text with style information from one place to another.

       

      Can someone help me out?

       

      Thanks in advance,

      Glen