1 Reply Latest reply on May 25, 2012 8:44 AM by Marc Autret

    How to get parent text frame of cell?

    Pooja_IDDev Level 1

      Hello ,

      I have a big table that runs in one text flow across different frames different pages, some with several text columns.

      I would like to know the parent text frame of cell.





      I get the parent text frame by writing either of the above line but if in case cell has overset then i dont get parent text frame.


      I tried following solution but as i said i have big table and for each and every cell i get the first text frame of the table.




      Please suggest any solution...


      Best Regrads


        • 1. Re: How to get parent text frame of cell?
          Marc Autret Level 5

          Hi Pooja,


          This is a very serious limitation of the DOM that we cannot directly access the parent text frame of a Cell object (provided that it actually belongs to such component).


          In the case you point out —a Cell that entirely overflows, i.e. myCell.insertionPoints[0].parentTextFrames.length===0— I don't know any way to get the actual parent frame. The only approach I see is to parse the parentRow of the targeted cell and to look if any other cell in that row can access to a parent frame, provided that all cells of a specific row should share the same parent frame. Of course, this workaround will not work if every cell of the row entirely overflows!


          Here is the snippet I suggest from there:


          function getCellFrame(/*Cell*/c)
          // -------------------------------------
          // Try to find the TextFrame that 'contains' c (if any)
          // Return the TextFrame if found, otherwise:
          // => NULL if the tf cannot be determined
          // => FALSE if sth goes wrong
              var a, i, t;
              if( !(c instanceof Cell) )
                  return false;
              if( (a=c.insertionPoints[0].parentTextFrames).length )
                  return a[0];
              a = c.parentRow.cells.everyItem().insertionPoints[0].parentTextFrames;
              i = a.length;
              while( i-- ){ if( t=a[i][0] ) break; }
              return t || null;


          Would be interested in whether our colleagues know a better solution.