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

Fit tables to content

New Here ,
Jun 23, 2008 Jun 23, 2008
Hello,

Perhaps this has been asked before, although I didn't find much on it.

Is there a script that fits the width of a table to it's content? I need this to be done for an entire document and it would be nice if I don't have to select the table first.

If there isn't a script like this, can someone create it?

Kind regards,

Jort
TOPICS
Scripting
1.1K
Translate
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
People's Champ ,
Jun 24, 2008 Jun 24, 2008
Hi,
Looking into Indesign interface, it seems that there is no way to adapt a table to its frame. By the way, I don't see any ability to set the width of a table but maybe I am wrong on this point ?
So, is there any script that allow that, to be honest, I don't think you can get something really good.
The closest lead I see should be something like :
A - get the width and heigth of the frame
B - get the number of columns and lines
C - set the width & heigth of cells to A/B.
You will understand how much this way can'tbe satisfying for you.
I hope I am wrong however.
Loic
Translate
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 ,
Jun 25, 2008 Jun 25, 2008
Hey Loic,

It's possible in InDesign to set the width of a cell in units. So is it possible to fit the cell size (width) to it's content?

Jort
Translate
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 Beginner ,
Jun 25, 2008 Jun 25, 2008
first - you need to check all cells in column for Overflow:

(a)
Property Overflows As Boolean
read-only
Member of InDesign.Cell
If true, the Cell has overset text.

and if you also need to have only one textline per paragraph in cell - you need to check number of textlines in each paragraph in cell

(b)
Property Lines As Lines
read-only
Member of InDesign.Paragraph
A collection of lines.

now - you need to increase width of column (or cell) - and check again (a) and (b)
you need to do this as long as all cells will be not Overflowed and/or paragraphs not multiline

robin

--
www.adobescripts.com
Translate
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 ,
Jul 02, 2008 Jul 02, 2008
LATEST
I am quite into dynamic table optimization (if this is what you want to do).

A) grow columns to a preset maximum
B ) shrink each column until the table gets higher (or column overflows)
(a table gets higher if a column has more lines of text)
C) react on the situation:
C1) if the table is bigger (in width) than the textframe,
shrink columns again
C2) if it is smaller, make them bigger

If you use the right algorithms, it's quite fast as well!

Marc
Translate
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