Skip to main content
Andreas Jansson
Inspiring
May 19, 2009
Question

The geometricBounds of a table cell - what's the best approach / practice?

  • May 19, 2009
  • 1 reply
  • 1802 views

To get the coordinates of a cell in a table, do you have to calculate that using the widths and heights of the cells to the left and over the cell, or is there a simpler way? (Since there's no geometricBounds property for a cell.)

-- Andreas

This topic has been closed for replies.

1 reply

Inspiring
May 19, 2009

If you know that there is text in the cell in question, you can use the baseline and horizontal offset of the first character of the cell as the basis for calculating the cell's geometric bounds. It's a messy process though.

Dave

Andreas Jansson
Inspiring
May 20, 2009

Thanks for the alternate solution, Dave! Yes, there will (most probably) only be need for the coordinates of cells with textual contents. Would using the offsets of the first character be a faster or more reliable solution than adding the heights and widths of previous cells in the table?

And on the other hand is the adding of heights and widths as simple as that... or can there be circumstances when using the widths and heights of the cells do not always add up to a sum equalling the width and height of the whole table?

-- Andreas

Inspiring
May 20, 2009

The advantage of working with the text is that you don't have to worry (much) about tables that span pages. You can use the parent text frame of the text in the cell to easily work out which page the cell is on.

Dave