Question
Split a Table rows into separate page
Hi,
It is necessary to split a single table into multiple tables on multiple pages in order to do this. To split the table, I used the following script. Could you please assist me with this?
var myDocument = app.activeDocument;
for(var i=myDocument.textFrames.length-1; i>=0; i--)
{
for(var j=myDocument.textFrames[i].tables.length-1; j>=0; j--)
{
var Get_Table = myDocument.textFrames[i].tables[j];
var columnlength = myDocument.textFrames[i].tables[j].columns.length;
var rowlength = myDocument.textFrames[i].tables[j].rows.length;
var numRowsFirstPage =rowlength / 2;
var numRowsSecondPage = rowlength - numRowsFirstPage;
myDocument.pages.add();
myDocument.pages[0].select();
for (var k = 0;k< numRowsFirstPage;k++) {
myDocument.textFrames[i].tables[j].rows[k].move(LocationOptions.AT_BEGINNING, doc.pages[0]);
}
myDocument.pages[1].select();
for (var l = numRowsFirstPage; l < rowlength; l++) {
myDocument.textFrames[i].tables[j].rows[l].move(LocationOptions.AT_BEGINNING, doc.pages[1]);
}
}
}