Skip to main content
October 15, 2009
Question

[JS] [CS3] Break link to ObjectStyle

  • October 15, 2009
  • 1 reply
  • 632 views

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 < 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.

This topic has been closed for replies.

1 reply

Harbs.
Legend
October 15, 2009

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