Skip navigation
Currently Being Moderated

How to get parent text frame of cell?

May 22, 2012 7:28 AM

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.

 

currentCell.insertionPoints[0].parentTextFrames[0];

currentCell.texts[0].parentTextFrames[0];

 

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.

 

currentCell.parentColumn.parent.parent;

 

Please suggest any solution...

 

Best Regrads

Pooja

 
Replies
  • Currently Being Moderated
    May 25, 2012 8:44 AM   in reply to Pooja_IDDev

    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.

     

    @+

    Marc

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points