1 Reply Latest reply on Sep 24, 2014 8:44 PM by Chinnadk

    character style report

    harish9003

      Hi All,

       

      Can anyone help me over here,  I have to find a character style in a file and I have to get it's contents as a text report in my desktop.

       

      Thanks,

      Hari.

        • 1. Re: character style report
          Chinnadk Level 4

          Hi Hari,

           

          Try this,

           

          var doc = app.activeDocument,
              _tr = doc.stories.everyItem().textStyleRanges.everyItem().getElements(),
              rep = "",
              file = new File(doc.fullName.toString().replace(".indd", ".txt"));
          
          for(var i =0;i<_tr.length;i++)
          {   
                  if(_tr[i].appliedCharacterStyle.name == "charStyle")
                  {
                          rep += _tr[i].contents + "\r";
                      }
              }
          
          file.open("w");
          file.write(rep);
          file.close();
          file.execute();
          

           

          Regards,

          Chinna