Skip to main content
Participant
August 16, 2008
Question

Automatic table/column width?

  • August 16, 2008
  • 18 replies
  • 5897 views
Happy Saturday everyone....

Is there a way to have a table or column automatically size to its contents plus any spacing settings (e.g. 6 pt margins)?

Sure would be handy.

thanks,
Andrew
This topic has been closed for replies.

18 replies

August 17, 2008
It seems to me that Android wants an "at least" setting for column width the same as there is one for row height. I don't see where that should be a problem; I think table columns should be able to size automatically to content.

I don't think Peter G. was off at all in how he understood the request. In fact, that is exactly how such a feature would have to work: automatic returns would be nixed (not soft or hard returns) and the cell would size to the longest line.

Peter S., I think you may be off track a bit. Android's example was a column, not three columns. C = Coriander would be the defining width for the column containing A, B, and C.
RodneyA
Participating Frequently
August 17, 2008
This could be AppleScripted, which means it wouldn't be "live," but after you make changes you could hit a short-cut key and have the table columns resized.
_android_Author
Participant
August 17, 2008
Actually, yes, I want the column to expand to fit the widest line contained in that column.

Manual line breaks...

Also, consider the devastation of changing the point size of a style used in tables... and having several hundred tables in a publication.

Client: "Oh, let's increase the point size...."

Me: "Ok, see you in three days."

I think I'll make a suggestion.
Peter Spier
Community Expert
Community Expert
August 17, 2008
Peter G,

Do you think this is really what android is looking for? It looks to me like he wants the table to adjust columns for him without making a selection of any sort, and I don't get the impression that he wants the Coriander column to get wider to accommodate a description of where it is found in a single line.

Peter S.
Peter Spier
Community Expert
Community Expert
August 17, 2008
>I'd like to simply say that the table cell width should shrink to fit this content, with a 6pt margin to each side of the longest line.

Table styles allow you to specify cell padding, just as in CSS, and they allow you to specify a column width, also as in CSS, but I don't recall anything in CSS that will automatically make the apple column narrower that than the coriander, though it's been quite a few years since I did that kind of programming.

You can adjust this manually after filling the cells, but there is no way for InDesign to automatically know what that "longest line" is because it changes as you set the width, re-wrapping, just as paragraph text re-wraps when you adjust an ordinary text frame.

Once a table is populated, I'm sure you can script a solution that will look at the contents of header cells, for example, and adjust them, but there's no way to accomplish this with the current coding.

I can see a possibility that tables would be in constant flux as they are populated, constantly changing as each cell is filled or edited, and some people might actually like this, but personally I would find it annoying, unpredictable, and counterproductive, not to mention it would probably have a detrimental effect on other program performance.

Feel free to make a feature request: http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
Make sure you describe in great detail how you would expect this to work, including things like whether all columns should have the same width, or should adjust to the header cell in each column independently, and whether cells should be expanding vertically to accommodate this.

Peter
Participating Frequently
August 17, 2008
It's been possible in FrameMaker for ages. Any line-wrapped text in the selected columns unwraps to a single line, and the widths of the selected columns change to contain the longest unwrapped line plus the cell side margins; text font size doesn't change to fit a fixed column width.

HTH

Regards,

Peter Gold
KnowHow ProServices
_android_Author
Participant
August 17, 2008
Hi Peter,

Sorry, I totally disagree.

Just as one can set parameters in CSS to describe how to lay text into a box, one should be able to describe parameters to add padding around text in a box (or a table column), and have the witdh/height adhere to rules, regardless if the text is a single line or many.

Let's say I have a column of codes such as

A = Apple
B = Banana
C = Coriander

And so forth; I'd like to simply say that the table cell width should shrink to fit this content, with a 6pt margin to each side of the longest line. So we'd see the cell automatically fit to the width of "C = Coriander" +12pt.

Simply put, this would allow consistent automatic formatting.

You should see why what I am asking is -quite- possible ;)

Maybe there's a better way of doing it?

Andrew
Peter Spier
Community Expert
Community Expert
August 16, 2008
How big is a bread box?

Sorry, old family joke, but it points out that automatically size to the contents is a pretty loose specification. Are you saying all the text should be on a single line in every cell? Split into multiple lines? How many? How long should the line be?

You should see why what you are asking is not possible. What is possible is to define a column width as part of a table style, but that would be fixed, not variable.

Peter
maizna47463110
Participant
February 16, 2017

Hiu

Am looking for an Indesign 2017 script that will skip first column and  fit the table column with the longest word in the column and I can Apply it for all tables for example if the column contain:

I Play football =

it should fit like below

I Play

football

Can you help me with that please

Steve Werner
Community Expert
Community Expert
February 16, 2017

Moving to InDesign Scripting forum