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

Table - How to distribute column space based on the cell text. (InDesign)

Contributor ,
Jun 22, 2020 Jun 22, 2020

Copy link to clipboard

Copied

Hi Friends,

 

How to distribute column space based on the cell text (not equal distribute option). I need to set each column as different width. If you have any formula is there (or) any ideas your side, please share with me.

 

0.png

 

Thanks,

Karthik 

 

TOPICS
How to , Scripting

Views

846

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 ,
Jun 22, 2020 Jun 22, 2020

Copy link to clipboard

Copied

Hi Karthik,

there are so many variables in this game, so that you should aim for a solution, that stops after a given time and use the best solution in that amount of time. What time frame would you think is bearable for the usage? Two minutes per table? Five minutes? 10 minutes?

 

Search the forum. We already discussed that issue 10 years ago, I think.

Hm. But so many threads from the old InDesign scripting forum were not moved over to this new InDesign forum, so we may start over again here…

 

Also see into this basic technique:

https://www.indiscripts.com/post/2016/03/on-dichotomic-divide-and-conquer-algorithms

 

Regards,
Uwe Laubender

( ACP )

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 ,
Jun 22, 2020 Jun 22, 2020

Copy link to clipboard

Copied

Ah. And please give some guide lines like:

 

A. Overall width of table should be the same.

B. Maximum width of table should be text frame width.

Something like that.

 

Please attach a sample document we can discuss.

 

Regards,
Uwe Laubender

( ACP )

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
Contributor ,
Jun 22, 2020 Jun 22, 2020

Copy link to clipboard

Copied

Hi Uwe,

 

Thanks your reply!

I have attached the "indd" sample document below.

In document all details is there. (Portrait and landscape tables).

InDesing version CC 2018

 

https://drive.google.com/file/d/1EywM8F2X7rwAKsPeUA-cEMuPnZPgPs-k/view?usp=sharing 

 

Thanks,

Karthik 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
Community Expert ,
Jun 22, 2020 Jun 22, 2020

Copy link to clipboard

Copied

Hi Karthik,

cannot download your sample doc without a password.

 

Regards,
Uwe Laubender

( ACP )

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 ,
Jun 22, 2020 Jun 22, 2020

Copy link to clipboard

Copied

You could attach the document to your reply in the forum.

 

Thanks,
Uwe Laubender

( ACP )

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
Contributor ,
Jun 22, 2020 Jun 22, 2020

Copy link to clipboard

Copied

HI Uwe,

 

Okay, my attachement below: I have placed screenshot for your reference.

 

11.png

 

Thanks,

Karthik 

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 ,
Jun 23, 2020 Jun 23, 2020

Copy link to clipboard

Copied

Hi Karthik,

something went wrong witth your attachment. Perhaps the file size was too large?

Try Dropbox for sharing with a public link. I know, that will work.

 

Screenshot from the thread. You added an image:

AttachmentDidNotWork.PNG

Regards,
Uwe Laubender

( ACP )

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
Contributor ,
Jun 23, 2020 Jun 23, 2020

Copy link to clipboard

Copied

Hi Uwe

 

Try bleow link:

 

https://www.dropbox.com/s/3ns61hdl0yee0kj/Sample-Doc.indd?dl=0 

 

Thanks,

Karthik 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
Community Expert ,
Jun 23, 2020 Jun 23, 2020

Copy link to clipboard

Copied

Thanks. That worked.

 

Regards,
Uwe Laubender

( ACP )

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
Contributor ,
Jun 24, 2020 Jun 24, 2020

Copy link to clipboard

Copied

Hi Uwe,

 

You got any solution?

 

Thanks,

Karthik 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
Community Expert ,
Jun 24, 2020 Jun 24, 2020

Copy link to clipboard

Copied

As Uwe said, this has been discussed endlessly. I mention a strategy in my 2013 InDesignSecrets article: https://indesignsecrets.com/tackling-tables-through-scripting.php -- first, tighten all columns as much as possible, then divide the remaining space over the columns.

Here is your sample table 1:

 

_Jongware__0-1593011884839.png

 

but it does not work nicely for that huge rotated table 2 (presumably because to fit, all lines need to wrap; you will have to think of something for that on your own). A nicer example is your table 3, where everything fits on a single line, with room to spare:

 

_Jongware__1-1593011940448.png

 

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 ,
Jun 24, 2020 Jun 24, 2020

Copy link to clipboard

Copied

Karthik said:

"…You got any solution?"

 

No. Just had no time looking very deep into my repository of functions to dig up something reasonable.

 

Had a function at hand, but only for a particular project where it was clear from the start that the contents of every cell in the table was one single line of text only. And it was only working with not rotated tables or not rotated text in table cells, because I used properties like endHorizontalOffset and horizontalOffset for ease of use and efficiency.

 

Ten years ago I also played around with trying to permanently calculate whitespace in tables while changing table column width also having an eye on the overall height of a table. Minimizing whitespace could be an aim, but you could also overdo things.

 

Because: there is yet another thing on top of all the efforts on optimization of space and doing calculations of any kind:

Readability. It could be that a table with optimized height and optimized column width is less readable or digestable by the average reader. Avoid rotated tables could be one aim for example.

 

FWIW: This is a major project you could invest weeks and months.

 

Regards,
Uwe Laubender

( ACP )

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
Contributor ,
Jun 25, 2020 Jun 25, 2020

Copy link to clipboard

Copied

Hi Uwe /Jongware

 

Thanks for your best effort.

 

I have find out one solution. But, i need another better solution for this game.

Step by Step:

  for loop all tables

     for loop all columns

       for loop each column cell

         get max count of characters in the array for all columns  (Exp: Total character count 125)

           get available table width (Exp: 200 points)

             for loop, get max character length in the first column (Exp: character length 24)

My formula start below:

Step 1: 200 * 24 = 4800 pt

Step 2: 4800 / 125 = 38.4 pt

Answer:  Applied column width = alredy cloumn width + 38.4 pt.

 

Note: This formula working fine in the "portrait and landscape" tables. But, i am searching best one. Could you please suggest good one.

 

Thanks,

Karthik 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
Community Expert ,
Jun 25, 2020 Jun 25, 2020

Copy link to clipboard

Copied

Hi Karthik,

funny enough I thought this morning also on a solution of counting characters.

But this will not take into account the text's behavior with text composition ( e.g. hyphenation and other setting like keepWithNext or noBreak ). It also will not tell anything about the space a text would need: Different point sizes, cell insets, other paragraph insets and so on.

 

Before you start best make sure:

[1] No overset of the story of the table.

[2] No permanent overset of table cells.

[3] For every cell set autoGrow to true.

[4] Check values for maximumHeight and minimumHeight of the cell.

 

Regards,
Uwe Laubender

( ACP )

 

 

 

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
Contributor ,
Jun 25, 2020 Jun 25, 2020

Copy link to clipboard

Copied

HI Uwe,

 

Thanks!

YES, you are right! that's why, I search another solution. Anyway, i will followed your guidelines.

 

Thanks,

Karthik 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
Community Expert ,
Jun 25, 2020 Jun 25, 2020

Copy link to clipboard

Copied

Hi Karthik,

look into Jongware's script and test this with your tables.

Before unrotate all the text frames that hold a table ( table 2 for example ) and change the width of the table to the preferred one. Then run the script to optimize colum width.

 

Regards,
Uwe Laubender

( ACP )

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
Contributor ,
Jun 25, 2020 Jun 25, 2020

Copy link to clipboard

Copied

LATEST

Hi Uwe,

 

Okay! sure

 

Thanks,

Karthik 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