1 Reply Latest reply on Apr 23, 2017 11:09 AM by uniqued_tol

    Removing the unused character style also deletes the bullet

    uniqued_tol Level 1

      I'm using this script (Kasyan Servetsky) in my documents but character styles in bullets are removed too.

      Have any way to preserve in these cases?

      var myDoc = app.activeDocument;  
      var myCharStyles = myDoc.allCharacterStyles; 
      for (i = myCharStyles.length-1; i >= 1; i-- ) {
        
         removeUnusedCharStyle(myCharStyles[i]);  
      }  
      function removeUnusedCharStyle(myChStyle) {  
         app.findTextPreferences = NothingEnum.nothing;  
         app.changeTextPreferences = NothingEnum.nothing;  
         app.findTextPreferences.appliedCharacterStyle = myChStyle;  
         var myFoundStyles = myDoc.findText();  
            if (myFoundStyles == 0 )  
            {  
               myChStyle.remove();  
            }  
         app.findTextPreferences = NothingEnum.nothing;  
         app.changeTextPreferences = NothingEnum.nothing;  
      }  
      

      I need to preserve character style into paragraph style!

      Thanks advice...