How to move some xml element and its content to a new frame
hi all,
how move xml element , content new frame.
hi chinnadk,
please try below js code, move margintag text anchored text frame , applied object style also.
#target indesign; #include "/program files (x86)/adobe/adobe indesign cs5.5/scripts/xml rules/glue code.jsx" var mydoc = app.activedocument; //____________________ xml rule set var myruleset = new array (new margintag); with(mydoc){ var elements = xmlelements; __processruleset(elements.item(0), myruleset); } function margintag(){ this.name = "margintag"; //this.xpath = "//margintag[@type='mn2']"; this.xpath = "//margintag"; this.apply = function(myelement, myruleprocessor){ with(myelement){ app.select(myelement); try{ var myprepara = app.selection[0].paragraphs[-1].parenttextframes[0].paragraphs.previousitem(app.selection[0].paragraphs[-1]); if(myprepara.characters[-1].contents=="\r"){ myprepara.characters[-1].remove(); } var mytextframe = myelement.placeintoinlineframe(["7p9","6p"]); mytextframe.appliedobjectstyle= mydoc.objectstyles.item("mn1"); mytextframe.fit(fitoptions.frame_to_content); mytextframe.parentstory.paragraphs.everyitem().appliedparagraphstyle = app.activedocument.paragraphstyles.itembyname("mn1"); }catch(e){} app.selection = null; } return true; } }
thx,
csm_phil
More discussions in InDesign Scripting
adobe
Comments
Post a Comment