Skip to main content
Participating Frequently
December 6, 2011
Question

How to detect which rows of a table are in one part?

  • December 6, 2011
  • 1 reply
  • 667 views

Hello,

I have a big table (with header and footer rows and different row heights) that runs in one text flow across different frames, some with several text columns.

I would like to know which table rows are shown in which frame. And if the frame has more than one text column, in which text column the rows are shown.

So if you think of InDesign "splitting" the table in several smaller ones for each column and textframe, I want to know which rows are together in one table and where this table is located.

I think I can get the parent text frame with:

currentCell.insertionPoints[0].parentTextFrames[0]

and then remember which cells (and their rows) are in the same frame.

But I do not know how to get the correct text column in the parent text frame.

Or maybe there is different/better way to collect this information.

Best regards,

Ingo

PS: The reason for this problem is that first, the table with content is created. Then I want to run a script that does some adjustements to the table to produce a nicer layout (e.g. a sort of vertical balancing)

This topic has been closed for replies.

1 reply

Inspiring
December 6, 2011

Interesting question. There's no "parentTextColumn" property, so maybe the only way to determine the textColumn of a cell is to figure it out based on the horizontalOffset of the first insertion point of the cell, the geometricBounds of parentTextFrames[0] and the number of text columns it has? That's no fun.

ikitzmannAuthor
Participating Frequently
December 9, 2011

Matthew Mariani wrote:

Interesting question. There's no "parentTextColumn" property, so maybe the only way to determine the textColumn of a cell is to figure it out based on the horizontalOffset of the first insertion point of the cell, the geometricBounds of parentTextFrames[0] and the number of text columns it has? That's no fun.

Yes, that now the way I go: calculate the left edge of the cell, then get the width of one text column and the space between the columns from the parent frame and calculate based on that information in which column the cell should be. It is not the nicest thing but it works (at least for rectangle frames and tables that are not wider than a text column).

Any better ways (e.g. which let InDesign deal with the calculation, so that I can be shure that I do not miss some rare circumstances) would be appreciated.