1 Reply Latest reply on Oct 15, 2009 5:02 PM by Harbs.

    [JS] [CS3] Break link to ObjectStyle

    CTC Imaging Level 1

      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.

        • 1. Re: [JS] [CS3] Break link to ObjectStyle
          Harbs. Level 6

          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