3 Replies Latest reply on May 29, 2014 6:31 AM by chrisl0878

    Cell style script not working in CS6

    chrisl0878

      I picked up the following script from the forum that is supposed to apply cell styles that I created to various cells.

      01.var myTable = app.activeDocument.stories.everyItem().tables;
      02. for (var n=0; n < myTable.length; n++){
      03.//~ myTable[n].appliedTableStyle = “NewTable”;
      04.//~ myTable[n].cells.everyItem().appliedCellStyle = app.activeDocument.cellStyles.item(“[None]“);
      05.//~ myTable[n].cells.everyItem().clearCellStyleOverrides (true);
      06.
      07.// Please check the table cell styles name is correct or not?
      08. var myActiveTable = myTable[n];
      09. myActiveTable.rows.itemByRange(0,-2).cells.everyItem().appliedCellStyle = “TTable_AA_Tint”;
      10. myActiveTable.rows[0].cells.everyItem().appliedCellStyle = “Table_Title”;//First Row
      11. myActiveTable.rows.itemByRange(-2,-1).cells.everyItem().appliedCellStyle = “Table_AA_Tint”;//Last Row
      12. }

       

       

      Whenever I run the script, I get the following message. Can someone please tell me what I need to change or fix? Any feedback would be highly appreciated

      JavaScript Error!
      Error Numnber:25
      Error String: Expected:;

      Engine:main
      File C:\Program Files (x86)\Adobe\Adobe InDesign CS6\Scripts\Scripts Panel\AutoFormatTablesWithCellStyles.jsx
      Line:2
      Source: 01.var myTable=
      app.activeDocument.stories.everyItem().tables;
      Offending Text:myTable