Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 173476

Script to select last row of a long table in every page

$
0
0

I have a problem in a script written to automatically flow long table over pages and i need now to select the last row in every page.

For Example, i have a long table consists of 120 row and will flow over 3 pages i need to select the last row in every page so i will select row number 41, 88, and 120, So, how can i write a code to select this.

NOTE: i can not know the number of rows in every page so, the rows number in the first page, second, and third page may be different.

I wrote a Code depend on the rows height as the following:

 

var rows = textFrameOri.tables[0].rows;
var rowsHeight = 0;    // GET THE EXACT NUMBER OF LAST ROW BEFORE BREAK and GIVE STYLE            var originalHeight = textFrame.geometricBounds[2] - textFrame.geometricBounds[0];            for(i = 0; i<rows.length; i++)            {                var height =rows[i].height;                rowsHeight +=height;                if(rowsHeight == originalHeight)                {                    index = rows[i].index;                    break;               }                if(rowsHeight > originalHeight)                {                    index = rows[i - 1].index;                    break;                }            }        rows[index].cells.everyItem().appliedCellStyle = "Body.bottom";

but this was not accurate. Please any help i will be grateful.

 

Thanks in advance,


Viewing all articles
Browse latest Browse all 173476

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>