• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Automatic table/column width?

New Here ,
Aug 16, 2008 Aug 16, 2008

Copy link to clipboard

Copied

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
TOPICS
Scripting

Views

5.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 16, 2008 Aug 16, 2008

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 15, 2017 Feb 15, 2017

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 16, 2017 Feb 16, 2017

Copy link to clipboard

Copied

LATEST

Moving to InDesign Scripting forum

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 16, 2008 Aug 16, 2008

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Aug 17, 2008 Aug 17, 2008

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 17, 2008 Aug 17, 2008

Copy link to clipboard

Copied

>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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 17, 2008 Aug 17, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2008 Aug 17, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 17, 2008 Aug 17, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 17, 2008 Aug 17, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 17, 2008 Aug 17, 2008

Copy link to clipboard

Copied

>Peter S., I think you may be off track a bit.

I think so too. I took it to mean that you might have a large table, say 6 columns just for fun, and that within the cells in any column you would have a mixture of images and descriptive text of varying lengths, some of which you might want to wrap. I further took android to mean that he wanted to be able to insert a table, with no parameters given other than the row and column counts, and that the table should size itself automatically to fit the content when he put it in, say by pasting from the clipboard.

I'm guessing now that isn't really it at all.

Peter S.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 20, 2008 Aug 20, 2008

Copy link to clipboard

Copied

>and that the table should size itself automatically to fit the content when he put it in

Yes, I think that is exactly what he advocates. "At Least" sizes itself to the content. You couldn't have any automatic text wrap in an "at least" column though, because the column would increase width as more text was inserted.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2008 Aug 21, 2008

Copy link to clipboard

Copied

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...

since when can you save column width into a table style ??? where ??? cell and table styles dont save anything about WIDTH or HEIGHT of columns rows or tables WHICH IS IN MY HUMBLE OPINION COMPLETE DISSASTER IN A FUNCTION THAT COULD BE A REAL HELP...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 21, 2008 Aug 21, 2008

Copy link to clipboard

Copied

> save column width into a table style ??? where ???

The OP wasn't about table styles, it was simply about column settings in tables.

I don't know for sure which way you're going on the styles issue. Whether you're saying to include cell width and height in table styles would be a disaster, or whether that they aren't there is a disaster (which is kinda illogical). That issue has been discussed in this forum, you could do a search to find arguments pro and con. (I tend to believe that those settings should not have been discluded from table styles.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2008 Aug 21, 2008

Copy link to clipboard

Copied

Well, at least there's some active discussion here. I currently have a 350 page doc with tables on nearly every page, and some of these settings would mean I could fine-tune things without a lot of overhead.

Andrew

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2008 Aug 21, 2008

Copy link to clipboard

Copied

I was just questioning somebody's claim

>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...

which isnt true because as we all know you cannot style column width...

I dont see anything ilogical in saving width and height in a cell style... it could be at least optional so you could include it only if you wanted like some atributes in object style or character style are optional... iam not and engineer so the concept might break appart somewhere down the road... but excluding height and width atributes from styles completelly wasnt necessary...

I understand that saving fixed width in a cell style might lead to many oversets in cells from one table to another...

but common workflow is that you style 20-50 more or less similar tables with pretty same content with some variations here and there maybe a column added or deleted etc. but now you spend awfull lot of time trying to keep all the columns widths consistent etc. when in ideal world you could style them all with one click and then just pinpoint few local overrides here and there...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 21, 2008 Aug 21, 2008

Copy link to clipboard

Copied

My apologies for saying you could save a column width. I don't use tables a lot, and obviously my memory is flawed on that point. You definitely CAN save cell padding as part of a cell style applied in a table style.

Peter

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 21, 2008 Aug 21, 2008

Copy link to clipboard

Copied

I'm one who'd like row heights to be part of Cell Styles. For instance, in a calendar, some months require five rows, others require six rows, and each month can change from year to year. (Next year February only needs four rows, which is pretty unusual.) I'd love to be able to select the rows of the month in question and change the row height using a style rather than having to remember what the appropriate row heights are and typing it in the boxes, which are several menu/dialog boxes deep.

Rodney

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2008 Aug 21, 2008

Copy link to clipboard

Copied

Iam just testing a demo of commercial plugin WoodWing Smart Styles CS3 which not only saves all indesign formating and indesign's own object/paragraph/table/cell styles assigned to objects on page...

But it also deciphers row heights and widths from an object and save these into its style specification... sounds like the best of both worlds (standard InDesign stylesheets + little bit of extra properties managed by the plugin)

Hopefully one dont get overhelmed of all the styles he has to manage to create a working template style...

Smart Styles CS3 can save widths and heights of not only cells and columns but also text frames and picture frames... WoodWing just dont see anything ilogical about giving user the option to save width a height of anything he created in INDD...

for CS3 Adobe licensed Teacup Software table styles engine for their table styles, maybe in CS4 they could also bring in some ideas from WoodWing development team to give us an ultimate combination of both approaches...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 22, 2008 Aug 22, 2008

Copy link to clipboard

Copied

>WoodWing just dont see anything ilogical about giving user the option to save width a height of anything he created in INDD

That is because SmartStyles despite their name are not styles as such. They are macros that format the table in question at the time of application. They are not linked to the table. Change the library-element (i.e. SmartStyle) and nothing changes automatically in the document.
With macros you can apply formatting one after the other and there is no danger of discrepancies. Styles are and stay applied all at the same time and contradicting settings become a real problem.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines