2 Replies Latest reply on Jun 25, 2015 1:16 AM by VarunParashar31

    Find maximum value and apply cell style

    VarunParashar31

      How can we find and apply cell style to a maximum value in selected cells of a table in InDesign with the help of scripting?

        • 1. Re: Find maximum value and apply cell style
          Laubender Adobe Community Professional & MVP

          Can you be more clear what you like to do?

          What maximum value?

           

          Uwe

          • 2. Re: Find maximum value and apply cell style
            VarunParashar31 Level 1

            Hi Uwe,

             

            Thanks for your response!

             

            I have a large table with a lot of numbers in it. Where the sections are divided into separate columns. I need to find out:

            Maximum value and change the color of the cell to Red,

            Median value and change the cell color to Yellow, and

            Minimum value and change the cell color to Green.

             

            Please let me know if this is possible through script.

             

            I have a script (below) that only works with the specific word, but I need that to change it according to my requirement.

             

            var myDoc = app.activeDocument

            app.findTextPreferences = app.changeTextPreferences = null

            app.findTextPreferences.findWhat = "Banana"

            var myFound = myDoc.findText()

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

            {

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

                {

             

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

                  var overrides = myFound[i].clearOverrides()  //this is the new line added in this content

              

                }

            }