2 Replies Latest reply on Jul 22, 2009 10:26 PM by dhishok

    retain Nested Styles...

    dhishok Level 1

      Dear everyone,

       

      I have developed the script for creating such character styles and applying it to control many character formats like Italic, Bold, Bold Italic, Superscript, subscript etc.... And its working fine. In some of paragraphs the texts having nested styles. And it is fixed in the paragraph style. When i  run the script, the character style applied to this nested style applied text also. So I don't want to apply character styles if the texts are having nested styles.

       

      Now i am trying to find the nested styled contents, then the character style "None" is applied to those contents. Find the part of my script below and it is not completed.

       

      //=======================

       

      myDoc = app.activeDocument;

       

      try{
      app.findTextPreferences = app.changeTextPreferences = null;
      app.findTextPreferences.fontStyle = "Italic";
      app.findTextPreferences.position = Position.normal;

       

      myFind=myDoc.findText(false);

       

      for(i=myFind.length-1;i>=0;i--)
      {
          if(myFind[i].contents.nestedStyles==null)
          {
              myFind[i].appliedCharacterStyle="cs_Itl";
              }
          else{
              myFind[i].appliedCharacterStyle=myDoc.allCharacterStyles[0];
              }
          }
      }
      catch(r){alert(r);}

       

      alert ("Done");

      //======================

       

       

      Can anyone look into this and help me out. Also suggest me if there is any better way to do this.

       


      Thanks in advace

      Thiyagu