Skip to main content
Inspiring
June 30, 2011
Answered

Copy text with styleinformation

  • June 30, 2011
  • 1 reply
  • 474 views

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

This topic has been closed for replies.
Correct answer Jongware

Per its description, the 'contents' of all text objects only contain ASCII/Unicode characters, and stuff from the SpecialCharacters set. Formatting is handled "elsewhere".

Try oldStory.move(), that ought to work.

1 reply

Jongware
Community Expert
JongwareCommunity ExpertCorrect answer
Community Expert
June 30, 2011

Per its description, the 'contents' of all text objects only contain ASCII/Unicode characters, and stuff from the SpecialCharacters set. Formatting is handled "elsewhere".

Try oldStory.move(), that ought to work.

Bal_GlenAuthor
Inspiring
July 1, 2011

Ofcourse, why didn't I see it.

Thank you.