1 Reply Latest reply: Aug 15, 2010 7:55 PM by Steven.. RSS

    I need to preserve the local formatting while delete and replace styles using JS

    Green4ever Community Member

      Hi,

       

      While delete and replacing the style using JS.. The local formatting is not carried with that. I mean it is like clearing over rides after over rides...

       

      But i need those local formatting to be preserved. (italic, super script, subscript, bold, etc... ) Is it possible in Java script... can anyone help on this regard..

       

       

      //clear the find and change preferences before running this lines....

      function replaceStyle(pstyle, newStyle){
          with (app.findGrepPreferences)
              {
                  appliedParagraphStyle = pstyle;
                  }
          with (app.changeGrepPreferences)
              {
                  appliedParagraphStyle = newStyle;
                  }
          app.documents.item(0).changeGrep();
      }

       

      replaceStyle("ct", "tt");

       

      Thanks in advance...