Remove Unused Paragraph Styles - without basedOn styles
hi all,
i have deleting unused paragraph style, re-flow content reason "basedon" style deleted.
how avoid deleting basedon styles.
example here:
1. haven't used "06 extract" paragraph style directly in paragraphs (texts), unused paragraph style.
2. have applied "06 extract 1p" paragraph style directly paragraphs (texts), connected "06 extract" pstyle indirectly "06 extract 1p"(with basedon option) see below.
while deleting unused styles, "06 extract" deleted , affect "06 extract 1p". so, re-flow occurring in document, how avoid this? no need remove using 'basedon' styles (example: "06 extract").
var mydoc = app.activedocument;
var myparstyles = mydoc.paragraphstyles;
var mycharstyles = mydoc.characterstyles;
(i = myparstyles.length-1; >= 2; i-- ){
removeunusedparastyle(myparstyles[i])
}
(i = mycharstyles.length-1; >= 2; i-- ){
removeunusedcharstyle(mycharstyles[i])
}
function removeunusedparastyle(mypastyle) {
app.findtextpreferences = nothingenum.nothing;
app.changetextpreferences = nothingenum.nothing;
app.findtextpreferences.appliedparagraphstyle = mypastyle;
var myfoundstyles = mydoc.findtext();
if (myfoundstyles == 0) {
mypastyle.remove();
}
app.findtextpreferences = nothingenum.nothing;
app.changetextpreferences = nothingenum.nothing;
}
function removeunusedcharstyle(mychstyle) {
app.findtextpreferences = nothingenum.nothing;
app.changetextpreferences = nothingenum.nothing;
app.findtextpreferences.appliedcharacterstyle = mychstyle;
var myfoundstyles = mydoc.findtext();
if (myfoundstyles == 0) {
mychstyle.remove();
}
app.findtextpreferences = nothingenum.nothing;
app.changetextpreferences = nothingenum.nothing;
}
advance thanks,
dev
hi all,
kindly this.
dev.
More discussions in InDesign Scripting
adobe
Comments
Post a Comment