7 Replies Latest reply on Apr 29, 2016 3:57 AM by tpk1982

    Need to select ALL tables

    piab59734901 Level 1

      Hi,

       

      I import Word documents in InDesign CC, wich contains several tables.

      I need to select ALL tables and then change the size of the text inside the cells and I need to change the table strokes inside and the table-border.

      I know how to install a script in InDesign – though I have not yet tried to work with a script ...

      ... hope my first time will be succesfull :-))))

       

      Hope that somebody can help me.

       

       

      Regards,

      Pia (graphic designer)

        • 1. Re: Need to select ALL tables
          tpk1982 Level 4

          hi..

           

          try this

          change the values as your requirement:

           

          app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().paragraphs.everyItem().pointSize = "3pt";
          
          app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().topInset = "3pt";
          app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().bottomInset = "3pt";
          app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().leftInset = "3pt";
          app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().rightInset = "3pt";
          app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().bottomEdgeStrokeWeight = "0.5";
          app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().topEdgeStrokeWeight = "0.5";
          app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().leftEdgeStrokeWeight = "0.5";
          app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().rightEdgeStrokeWeight = "0.5";
          
          • 2. Re: Need to select ALL tables
            piab59734901 Level 1

            It works :-)))))) thanks to you I just run my first script ever :-)))))

            Looking forward to changing the sizes.

             

            You are awesome – thanks a million :-))))) and have a great day.

             

            Regards,

            Pia

            • 3. Re: Need to select ALL tables
              tpk1982 Level 4

              Hey Pia,

               

              Which size need to change?

               

              Also please give correct answer if it works fine.

               

              Have a nice day

               

              karthi

              • 4. Re: Need to select ALL tables
                piab59734901 Level 1

                Hi Karthi

                 

                By sizes I mean the text-pt-sizes and the stroke-sizes (the blue text) :-))

                 

                I have one problem though – the table bottomEdgeStroke is different from table to table. Ex. in a 4 row table I may only need a stroke on the bottomEdgeRIGHT row. Other times 3 rows or 2 rows.

                 

                Think that the solution may bee a script that SELECTS ALL TABLES and then I can apply an InDesign TableStyle?

                Is that possible?

                 

                --

                Sorry – I thought I gave a correct answer above :-))) your script still works fine :-))))

                You solved the problem I had :-)))

                 

                Regards,

                Pia

                • 5. Re: Need to select ALL tables
                  tpk1982 Level 4

                  Hi Pia,

                   

                  Try this below script. It will ask you the values (take as points) to change. I don't think table style give solution.

                   

                  //changing measurement as points
                  app.activeDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.POINTS;
                  app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.POINTS;
                  var myText=prompt("PLEASE ENTER YOUR TEXT POINT SIZE","")
                  var myStroke=prompt("PLEASE ENTER YOUR TABLE STROKE VALUE","")
                  var myBottomStroke=prompt("PLEASE ENTER YOUR TABLE BOTTOM STROKE VALUE","")
                  //changing text point size
                  app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().paragraphs.everyItem().pointSize = myText;
                  //changing text stroke size
                  app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().bottomEdgeStrokeWeight = myBottomStroke;
                  app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().topEdgeStrokeWeight = myStroke;
                  app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().leftEdgeStrokeWeight = myStroke;
                  app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().rightEdgeStrokeWeight = myStroke;
                  

                   

                  Please let me know if this is fine.

                   

                  Note: i removed the inset value coding, hope you don't require that.

                   

                  Regards,

                  Karthi

                  • 6. Re: Need to select ALL tables
                    vidhyar34646163

                    Hi,

                     

                      I have same issue to select all the tables. I don't need to change table styles ,But need to select all the tables simultaneously. How to do tat? I need like,

                     

                    app.activeDocument.stories.everyItem().tables.everyItem().getElements()[i].select();

                    • 7. Re: Need to select ALL tables
                      tpk1982 Level 4

                      see this thread..hope this is useful

                       

                      Select table using script