Tuesday, March 30, 2010

[JS] [CS3] Break link to ObjectStyle

I have no problem doing this for paragraphStyles while maintaining attributes but I can't do it for objecStyle!!!

It applies style [None] BUT clears existing object attributes EVEN when specifying clearingOverrides to ''false''

===========================

function BreakStyleLink (itsITM)
{
var myDoc = app.activeDocument;
if (itsITM.constructor.name == ''InsertionPoint'')
?itsITM = itsITM.parent;
var myTSR = itsITM.textStyleRanges;
for (var cptTSR = 0; cptTSR %26lt; myTSR.length; cptTSR++)
{
?app.select(myTSR[cptTSR]);
?myTSR[cptTSR].applyParagraphStyle(myDoc.paragraphStyles[0], false);
}
itsITM.applyObjectStyle(myDoc.objectStyles[0], false); //*** !!!!!!!!!!!!!!!!!! What's up w/ that

return;
}

=========================

any ideas. I am sure it's another setting somewhere else.

Thanks for any guidance.

[JS] [CS3] Break link to ObjectStyle

Don't know. I don't think I've ever tried to remove an object style...

Two things you might want to try (besides filing a bug report):

1) Object.appliedObjectStyle = myDoc.objectStyles[0];

2)

dupStyle = Object.appliedObjectStyle.duplicate();

Object.appliedObjectStyle = dupStyle;

dupStyle.remove();

Harbs

No comments:

Post a Comment