14 Replies Latest reply on May 11, 2016 1:36 PM by Obi-wan Kenobi

    How do your force table widths to width of text frame?

    cmscss Level 1

      Hi There,

       

      Is there a way to save an enormous amount of time by forcing tables to redistribute column widths (by percentages or other means) based on the size of the text box?

       

      Currently, we have to resize each column individually.

       

      Cheers

       

      Ben

        • 1. Re: How do your force table widths to width of text frame?
          SJRiegel Adobe Community Professional & MVP

          If your table is on just one page, you can grab the bottom right corner (with the text tool selected) to re-size all the columns proportionally. (you will see a diagonal two-headed area when you are over the correct place to grab)

          • 2. Re: How do your force table widths to width of text frame?
            TᴀW Adobe Community Professional & MVP

            Take a look at this I wrote a few months ago, towards the end of the post: http://www.id-extras.com/delete-all-empty-rows-or-columns-from-an-indesign-table

             

            Not free, but cheap. It lets you set a fixed width for all or some tables (so you'd have to supply the table width -- it won't automatically snap to the frame width). And there's a bunch of other options that may or may not be useful.

             

            Ariel

            • 3. Re: How do your force table widths to width of text frame?
              cmscss Level 1

              @SJRiegel Thanks for that, I tend to work by numbers so like to enter an exact width but this click and drag option works fine.

               

              @TaW Looks very useful thank you.

               

              I realise it's  unpopular to say that tables in InDesign are painful but they're certainly non-intuitive which is painful!

               

              Thanks for the replies,

               

              Cheers

               

              Ben

              • 4. Re: How do your force table widths to width of text frame?
                SJRiegel Adobe Community Professional & MVP

                macopp:

                 

                For exact numbers, there is a free script. It allows you to set column widths, and save them in a table style to apply to other tables.

                A link to the script is in the linked thread:

                 

                Re: column width in cell specs

                • 5. Re: How do your force table widths to width of text frame?
                  Laubender Adobe Community Professional & MVP

                  Hi Ben,

                  the script "Autospalte2" by Gerald Singelmann that SJRiegel has pointed at is still working with InDesign CC 2015.

                  I just tested that with my German version.

                   

                  Uwe

                  • 6. Re: How do your force table widths to width of text frame?
                    smoothsea Level 3

                    Hi,

                     

                    I may not have understood your question correctly, but I just grab the end of the last column and drag it to the frame edge, then select all columns and right-click - distribute columns evenly.

                     

                    Regards,

                     

                    Malcolm

                    • 7. Re: How do your force table widths to width of text frame?
                      Laubender Adobe Community Professional & MVP

                      Hi Malcom,

                       

                      grabbing the lower right corner of the table using the Type tool and moving towards the edge of the text frame sometimes is ok with Ben ( my personal interpretation of his goals ). But it could be hard not to change the height of the cells in that process. It's not so easy to maintain the overall height of the table using the mouse by dragging the lower right edge …

                       

                      JRiegel's advice in answer #1 could be marked as correct here.
                      Together with some advice how to maintain the height of the cells.

                      ( But I don't know, if there is a method for exactly maintaining that while dragging. )

                       

                      And so Ben often (always?)  sees the necessity to

                      1. Maintain height of rows

                      2. Give some columns exact integer values and wants to do the math for all the rest.

                       

                      So to distribute all column widths evenly is not the point here, I think.

                      A script like Gerald Singelmann's "Autospalte2" is exactly what he needs to complete the task.

                       

                      ( All my personal interpretation of Ben's goals here )

                       

                      Uwe

                      • 8. Re: How do your force table widths to width of text frame?
                        Rudi Spitzers Level 1

                        Just a thought. Why not auto-resize the frame instead of the table? Objectmenu> Text Frame options.

                        Rudi

                        • 9. Re: How do your force table widths to width of text frame?
                          Laubender Adobe Community Professional & MVP

                          Rudi Spitzers wrote:

                           

                          Just a thought. Why not auto-resize the frame instead of the table? Objectmenu> Text Frame options.

                          Rudi

                          Because the text frame's width should dictate the width of the table here.

                          And not the other way arround.

                           

                          Plus: Maybe there is other contents inside the text frame, e.g. text before and after the table and the text frame itself is part of a story of several text frames that are threaded.

                           

                          Uwe

                          • 10. Re: How do your force table widths to width of text frame?
                            BarbBinder Adobe Community Professional

                            So many good ideas, and I'm going to toss out one more. When I'm working on a layout job, I take a few minutes to jot down the the pertinent numeric values, and put them on my monitor via a post it. The values include paper size (w & h), image area (w & h), width of a single column, width of combined columns (2 cols ,3 cols ,4 cols, etc). That way, when I'm sizing objects I know without effort what size I need. In your scenario, I'd know exactly how wide to make the table, based on the column widths.

                            • 11. Re: How do your force table widths to width of text frame?
                              cmscss Level 1

                              Thanks everyone, answer number one was the closest but still not ideal - you often want tables to auto-fit to the size of the text box.

                               

                              @BarbBinder I think you and I are a rare breed! A lot of people don't understand that pointing and clicking is capping their salary. Doing things by the numbers has always been faster and more accurate.

                              • 12. Re: How do your force table widths to width of text frame?
                                Obi-wan Kenobi Adobe Community Professional

                                Just a comment [have not read all of you!]

                                 

                                // No selection at all: do all tables in the active document  
                                // Selection is insertion point in cell: do only the current table  
                                // Selection is a text frame or an insertion point outside a table: do all the story's tables  
                                  
                                (function () {  
                                  
                                  function getTables () {  
                                    if (app.selection.length == 0) {  
                                      return app.documents[0].stories.everyItem().tables.everyItem().getElements();  
                                    } else if (app.selection[0].parent instanceof Cell) {  
                                      return [app.selection[0].parent.parent];  
                                    } else if (app.selection[0].hasOwnProperty ('parentStory')) {  
                                      return app.selection[0].parentStory.tables.everyItem().getElements();  
                                    }  
                                  }  
                                  
                                  function fitTables (tables) {  
                                    for (var i = tables.length-1; i >= 0; i--) {  
                                      try {  
                                        var frame = tables[i].storyOffset.parentTextFrames[0];  
                                        var diff = frame.geometricBounds[3] - frame.geometricBounds[1] - tables[i].width;  
                                        var columns = tables[i].columns.everyItem().getElements();  
                                        var space = diff/columns.length;  
                                        for (var j = columns.length-1; j >= 0; j--) {  
                                          columns[j].width += space;  
                                        }  
                                      } catch (_) {  
                                        // Fail silently  
                                      }  
                                    }  
                                  }  
                                  
                                  if (app.documents.length > 0) {  
                                    fitTables (getTables());  
                                  }  
                                  
                                }());  
                                
                                
                                1 person found this helpful
                                • 13. Re: How do your force table widths to width of text frame?
                                  cmscss Level 1

                                  Thanks for that - what is that Language and how does it integrate with InDesign?

                                   

                                  I use InDesign less and less as 90% of my work is web coding these days, so the variables and functions look very familiar - is that Javascript?

                                  • 14. Re: How do your force table widths to width of text frame?
                                    Obi-wan Kenobi Adobe Community Professional

                                    Javascript [use the ESTK or a simple text editor], save as .jsx and place it in the script panel folder!

                                    … If you want to adjust in one click all the tables to the frame width, it's for you! 

                                    1 person found this helpful