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

Table selection spanning multiple frames/pages

Guest
Feb 29, 2008 Feb 29, 2008
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!
TOPICS
Scripting
496
Translate
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
Participant ,
Feb 29, 2008 Feb 29, 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
Translate
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
Guest
Mar 02, 2008 Mar 02, 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
Translate
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
Participant ,
Mar 02, 2008 Mar 02, 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
Translate
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
Guest
Mar 02, 2008 Mar 02, 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
Translate
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
Participant ,
Mar 02, 2008 Mar 02, 2008
LATEST
Try:

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

Dave
Translate
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