9 Replies Latest reply on Nov 8, 2018 3:54 AM by hasvi

    Character style overrides

    priyak7746321 Level 1

      How to remove the character style overrides.

       

      Its working if the content is non XML. But its not working if its xml structure content.

       

      How to check the applied character style if  whole paragraph applied character style.

       

       

      var myDoc = app.activeDocument;

       

      var mystories =  myDoc.stories;  

      for (var i = 0; i < mystories.length ;i ++){  

          for (var j = 0; j < mystories[i].paragraphs.length ; j ++){  

            

              if (mystories[i].paragraphs[j].texts[0].appliedCharacterStyle.fontStyle.toString()  != 'NOTHING'  )         {  

                    

                      if (mystories[i].paragraphs[j].appliedParagraphStyle.fontStyle.toString() ==  mystories[i].paragraphs[j].appliedCharacterStyle.fontStyle.toString()){                                        

                         try {

                                  mystories[i].paragraphs[j].appliedCharacterStyle = myDoc.allCharacterStyles[0];  

                                  mystories[i].paragraphs[j].clearOverrides(OverrideType.CHARACTER_ONLY);

                                } catch(e){}

                        

      } } } }