Skip to main content
March 1, 2008
Question

Table selection spanning multiple frames/pages

  • March 1, 2008
  • 5 replies
  • 486 views
I'm trying to determine whether a table selection spans multiple text frames and pages.

With a regular text selections (TypeName is Text, Word, Paragraph, etc.) I can use ParentTextFrames and check to see what page they are on, but that doesn't work the Table object.

Any ideas how I can determine whether a table selection spans a frame and/or spread?

Thanks!
This topic has been closed for replies.

5 replies

Inspiring
March 2, 2008
Try:

startCell = myTable.item("2:1");
endCell = myTable.item(3:3);
myCells = myTable.cells.itemByRange(startCell, endCell);

Dave
March 2, 2008
Both and that selection method makes perfect sense. I was wondering more about a portion of a table though.

I know that Cell(1).Name comes back in the format of 2:1, but couldn't figure out how to select cell 2:1 through cell 3:3, for instance. Is there a way to use the Select function with the 2:1 reference format?

Thank you,
Ken
Inspiring
March 2, 2008
Do you mean select or reference?

myCells = myTable.cells.itemByRange(0,-1)

references all the cells in myTable.

Note that this is the one case where using itemByRange(0,1) produces a difference results from using everyItem().

everyItem() references the cells as individual cells while itemByRange references them as a range of cells. Some of the stroke related properties have different meanings as a result.

Outside of tables, these two constructions produce the same results (I think).

Dave
March 2, 2008
Thanks Dave! You're a real life saver on this forum.
I think I'm going to use
InD.Selection(1).Cells(1).Texts(1).ParentTextFrames(1).Parent.Name
InD.Selection(1).Cells(-1).Texts(1).ParentTextFrames(1).Parent.Name
to find the first and last cells parent text frame, only I'm not using this exact code but looping until the parent is a page then getting the name.

I'm getting there with this stuff, albeit slowly. As an aside: I'm not having to do it with this script, but how in the heck does one simply select a range of cells in table from code?

Many thanks, yet again.
Ken
Inspiring
March 1, 2008
Two things come to mind:

1. Use the table's storyOffset object to get references to the "character" holding the table and thus the next one and compare their parentTextFrames.

2. Use the parentTextFrames property of the text in the first and last rows of the table.

Dave