4 Replies Latest reply on Sep 30, 2015 5:03 AM by SteveP-Integra

    Find/Change cell style with GREP

    SteveP-Integra

      Hi All, (my first post here)

       

      I found a handy script on this forum to find/change cell styles in a table. I adapted the script using Peter Kahrel's ebook for use with a GREP query.

       

      I've linked a spreadsheet in InDesign CC 2014 that I want to highlight the cell of new products that contain the value [Y].

       

      When I run the script below I am getting random results.

       

      var myDoc = app.activeDocument

      app.findGrepPreferences = app.changeGrepPreferences = null

      app.findGrepPreferences.findWhat = "\[\u\]"

       

      var myFound = myDoc.findGrep()

       

      for(i=0; i<myFound.length; i++)

      {

          if(myFound[i].parent.constructor.name == "Cell")

          {

        

         myFound[i].parent.appliedCellStyle = "New_Product_Cell"

       

          }

      }