1 Reply Latest reply on Feb 11, 2011 3:14 AM by [Jongware]-9BC6tI

    Script for Setting Irregular Column Widths in Tables

      I have irregular column widths that need to be part of a table style. Does anyone know of a script that would incorporate the irregular column widths in a table (preferable) or cell style?
      This question was asked in a previous forum - and an answer was given (listed below) but I am new to scripting in InDesign and I didn't know where to put this script.  I know where the script folder is and how to access them in InDesign once installed but that is about all.
      Thank you for your help.
      7. Jan 18, 2010 2:43 AM in response to: jay fresno
      Re: Table style that keeps column width

      Hi Jay,

      Number of columns in a table may vary depends on the book.

      If the columns count is constant then you can use the below script.

           var myDoc = app.activeDocument;
           var myWidths = [100, 100, 150, 150];
           for(var T=0; T < myDoc.textFrames.length; T++){
               for(var i=0; i < myDoc.textFrames[T].tables.length; i++){
                   for(var j=0; j < myWidths.length; j++){
                       myDoc.textFrames[T].tables[i].columns[j].width = myWidths[j];
           alert("Table width updated successfully...");

      In the above script i declared the 4 columns width(s) as 100pt, 100pt, 150pt & 150pt. Change width acording to your requirement.

      I think this will give you the solution.


      Ramkumar. P




        • 1. Re: Script for Setting Irregular Column Widths in Tables
          [Jongware]-9BC6tI Level 4

          Start up the ESTK (Adobe ExtendScript Toolkit editor) -- it should be installed along with your InDesign, but you may have to search for a while.

          It presents a blank screen, ready to type (if you are inclined to writing scripts).

          Copy the this-is-obviously-the-script part of the forum message and paste it into the ESTK.


          Select "File" -> "Save as..." and locate your InDesign User Scripts folder.(*) Save the script in there under any name you like, but make sure the file extension is ".jsx" (the ESTK editor may automatically add this, I dunno). When saved in the proper place, it will immediately be available in the Scripts Panel.


          (*) Can't locate your User Script folder? Then cheat -- save the script on your desktop. Go to InDesign, open the Scripts panel, and right-click any of the scripts you see in there. The little pop-up menu has an option "Reveal in Finder/Reveal in Explorer" -- select that, and the right folder will open! Now all you have to do is drag the saved script into this folder.


          http://indesignsecrets.com/how-to-install-scripts-in-indesign.php shows a couple of additional tips.