Overset textframe issue
Hi,
Occasionally, the overset feature does not work. If the text frame gets overset on the 3rd page, then the overset page won't be split.
In the attachment, you will find a script for splitting tables. Could you please guide me on this?
IterateDocument();
function IterateDocument()
{
// Get the active document
var doc = app.activeDocument;
// Loop through all pages of the document
for (var i = 0; i < doc.pages.length; i++) {
var page = doc.pages[i];
var pageHeight = page.bounds[2] - page.bounds[0];
// Loop through all text frames on the page
for (var j = 0; j < page.textFrames.length; j++) {
var frame = page.textFrames[j];
for(var k=frame.tables.length-1; k>=0; k--)
{
var table = frame.tables[k];
// Log the height of the text frame in the JavaScript console
var height = frame.geometricBounds[2] - frame.geometricBounds[0];
if(pageHeight < height)
{
AddColumnToTable(frame, i,table);
}
} // Get Table length
} // get Text Framelength
} //Get total page count
}
function AddColumnToTable (mySel,addPageLocation, originalTable)
{
var gb = mySel.geometricBounds;
gb[2] = gb[0] + originalTable.height/2;
gb= [95.891, 37.5, 730.458, 576];
mySel.geometricBounds = gb;
var newFrame = app.activeDocument.pages.add(LocationOptions.AFTER, app.activeDocument.pages[addPageLocation]);
var textframe = app.activeDocument.pages[addPageLocation+1].textFrames.add({
geometricBounds:[95.891, 37.5, 730.458, 576]
});
mySel.nextTextFrame = textframe ;
textframe.fit(FitOptions.frameToContent);
if(textframe.overflows == true)
{
AddColumnToTable (mySel,addPageLocation,originalTable);
}
}
