Style name tag
hi all,
can me pls need place paragraph style names in margins either can anchor box or separate box.
im using below script paragraph styles in box unable position of paragraph.
var mydoc = app.activedocument;
var pstyles = mydoc.allparagraphstyles;
for (var i= 2; i<pstyles.length;i++){
var cont = pstyles[i].name.tostring();
app.findtextpreferences = nothingenum.nothing;
app.findtextpreferences.appliedparagraphstyle = pstyles[i].name;
var myresults = mydoc.findtext();
var txfm = mydoc.pages.item(0).textframes.add();
txfm.geometricbounds = [10,10,50,50];
txfm.contents = cont;
txfm.textframepreferences.insetspacing = "1";
txfm.strokeweight = .5;
txfm.fit(fitoptions.frame_to_content);
}
thanks in advance,
learner
hi,
1. create object style desired settings
2. make anchored better solution, anchoredsettingoptions should set well
3. create new frame @ every foundoccurrence.insertionpoints[0];
4. apply object style, add contents, fit;
5. overset text should excluded (no geobound)
so exam this:
var mydoc = app.activedocument; var pstyles = mydoc.allparagraphstyles, cont, myresults, txfm, = mydoc.objectstyles.item("manchored_pstinfo"); if (!most.isvalid) = mydoc.objectstyles.add({name: "manchored_pstinfo"}); (most) { enableanchoredobjectoptions = true; enabletextframegeneraloptions = true; enablestroke = true; textframepreferences.insetspacing = 1; strokeweight = .5; (anchoredobjectsettings) { spinerelative = true; anchorpoint = anchorpoint.top_right_anchor; anchoredposition = anchorposition.anchored; anchoryoffset = 0; anchorxoffset = 0; horizontalalignment = horizontalalignment.left_align; horizontalreferencepoint = anchoredrelativeto.page_margins; verticalalignment = verticalalignment.top_align; verticalreferencepoint = verticallyrelativeto.capheight; } } (var i= 2; i<pstyles.length;i++){ cont = pstyles[i].name; app.findtextpreferences = nothingenum.nothing; app.findtextpreferences.appliedparagraphstyle = cont; myresults = mydoc.findtext(); len = myresults.length; while (len--) { if (myresults[len].parenttextframes[0] == null) continue; txfm = myresults[len].insertionpoints[0].textframes.add(); currgb = txfm.geometricbounds; txfm.appliedobjectstyle = most; (txfm) { geometricbounds = [ currgb[0], currgb[1], currgb[0] + 40, currgb[1] + 150 ]; contents = cont; fit(fitoptions.frame_to_content); } } }
jarek
More discussions in InDesign Scripting
adobe
Comments
Post a Comment