4 Replies Latest reply on Aug 30, 2013 11:24 PM by La0s

    justify tables




      Justifying of tables??? Is this scriptable.


      When putting a table into a textframe. The table is too big. The table should have the length of the textframe..


      How can I do this?


      Help please...

        • 1. Re: justify tables
          La0s Level 1

          Take a look at Jongwares AutoformatTables at inDesignSecrets:


          • 2. Re: justify tables
            [Jongware] Most Valuable Participant

            La0s, very nice of you to mention that -- but it does the inverse: it changes *column widths* but not  the overall *table* width.


            Onnozel: just set table.width to the desired size. InDesign will scale the individual columns, the same as when you scale a table manually by shift-dragging the rightmost column side.

            • 3. Re: justify tables
              DaveSofTypefi Level 2

              I'm afraid that's not true, Jongware. If you set a table width to anything other than its current width, the columns are all set to the same width. You need to calculate the percentage change you want for the table and apply that percentage to all the columns.



              • 4. Re: justify tables
                La0s Level 1

                Maybe this is what you are looking for?


                Take a look at function FitTableFrameWidth() in http://forums.adobe.com/message/5424181


                var myDocument = app.activeDocument;

                    for (s=0; s<myDocument.stories.length; s++) {

                            for (t=0; t<myDocument.stories[s].tables.length; t++) {

                                var myTable = myDocument.stories.item(s).tables.item(t);

                                var myTableParent = myTable.parent;

                                var parentWidth = myTableParent.geometricBounds[3] - myTable.parent.geometricBounds[1];

                                var factor = parentWidth/myTable.width;

                                for (col=0; col<myTable.columns.length; col++) {

                                    myTable.columns[col].width *= factor;





                You can follow the discussion behind the function here: