2 Replies Latest reply on Jul 16, 2009 11:55 PM by Martin Fischer

    How to get the access the continue table pages?

    R_Thangaraj Level 1

      hi to all

       

      here i have one long table that may continues in 3 or 4 pages when i try to get

      app.selection[0].contents.length in 1st page it return 1

      but when i try i get the continues pages of table

      app.selection[0].contents.length in 2nd Page it return 0

      actual requirement is i need to check the page whether empty or it has contents

      but it showing continues table content as empty page

       

      pls help with correct coding

       

      thanks

      Thangaraj

        • 1. Re: How to get the access the continue table pages?
          R_Thangaraj Level 1

          Hi to all

           

          i'm waiting for reply for my discussion from yesterday onwards but nobody yet reply to me

           

          thanks to all

          • 2. Re: How to get the access the continue table pages?
            Martin Fischer Level 2

            Hi Thangaraj,

             

            i try to get app.selection[0].contents.length in 1st page it return 1

            but when i try i get the continues pages of table

            app.selection[0].contents.length in 2nd Page it return 0

             

            I don't understand what kind of object you have selected and what you are trying to do with it's contents.

            Is it some text (some characters or words) or is it some cells or is it the table itself?

             

            A table appears in the text of the parent story like a character.

            Parent of a table is the textframe wherein the table 'starts'.

            There is no property like parentPage of cells or rows.

             

            To find out on which page a cell of a table is shown you can add an anchored object in this cell, release it and get the parent (page) of the released object.

            Try something like this (place the cursor inside a cell before processing):

             

            if (app.selection.length > 0 && app.selection[0].parent.constructor.name == 'Cell')
            {
                 var myFrame = app.selection[0].insertionPoints.firstItem().textFrames.add({
                      anchoredObjectSettings:{
                           anchoredPosition:AnchorPosition.ANCHORED, 
                           anchorPoint:AnchorPoint.CENTER_ANCHOR, 
                           horizontalAlignment:HorizontalAlignment.CENTER_ALIGN, 
                           verticalAlignment:VerticalAlignment.CENTER_ALIGN
                      }});
                 myFrame.parent.recompose();
                 myFrame.anchoredObjectSettings.releaseAnchoredObject();
                 alert('Page: ' + myFrame.parent.name);
                 myFrame.remove();
            } 

             

            You can find out the position of a table inside the parent story thru the property storyOffset.

            This results the insertion point before the table in the story containing the table.

            storyOffset.index + 1 results the index of the insertion point after the table.

            So you can find out the page where a table starts and the page where a table ends by analyzing this insertion points (the parent of the textframes where the insertion points are in).

             

            Martin