[CS5-5.5][JS] Replace xml element content with user selection
hi,
i'm trying write script replaces xml element content user selection.
i have document containing textframe "root" tag attached. in frame have 2 paragraphs, each tagged different tag.
i replace content of 1 of paragraphs content of text selection.
this piece of code doesn't seem work:
myxmlelement.xmlcontent = app.selection[0];
the problem properties of xmlelement (paragraphs, words, etc) read-only.
does have suggestion?
thanx
it depends on whether want maintain formatting. can use
myxmlelement.contents = app.selection[0].contents;
in (unlikely?) event don't mind blowing away formatting. otherwise you'll want use like:
myxmlelement.xmlcontent.remove(); app.selection[0].duplicate(locationoptions.at_beginning, myxmlelement.xmlcontent);
jeff
More discussions in InDesign Scripting
adobe
Comments
Post a Comment