This content has been marked as final. Show 4 replies
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.
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?
first - you need to check all cells in column for Overflow:
Property Overflows As Boolean
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
Property Lines As Lines
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
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!