Skip to main content
Inspiring
March 8, 2020
Question

Scripting: How to get page that selected table row is on

  • March 8, 2020
  • 1 reply
  • 630 views

I have a table that runs 500 pages.

Is there a way to identify what page any given row is on? Parent returns the page the table starts on.

 

 

    This topic has been closed for replies.

    1 reply

    Community Expert
    March 8, 2020

    Hi akiva_atwood ,

    I could not find a cleaner way to achieve this, however the following seems to work

    rowObj.cells[0].insertionPoints[0].parentTextFrames[0].parentPage.name

     

    -Manan

    -Manan
    Participating Frequently
    October 19, 2023

    That solution works fine, in principle, however, here are two important amendments:

    1. If you only need the actual page number, then you could of course use the name, but the "name" can appear multiple times within an InDesign document (different sections). So you have at least to check the section as well. Or you assess the page's "index" and in a second step you find out the actual page number.

    2. If the cell overflows, then you don't have a chance to assess any kind of insertion point, baseline etc. simply because this layout information is not present - since not shown on the monitor. What you have to do is to save the "<cell object>.texts[0]" first, then remove it eg using "<cell object>.texts[0].remove()", then assess the insertionPoint[0] plus additional information, and then restore the "<cell object>.texts[0]".