Copy link to clipboard
Copied
I’m trying to bring this function alive:
$.writeln( findPagesOfLastCells() );
function findPagesOfLastCells() {
// https://community.adobe.com/t5/indesign-discussions/javascript-property-to-tell-if-text-is-in-a-continued-table/td-p/6379093
var aDoc = app.activeDocument,
allTables = aDoc.stories.everyItem().tables,
thePages = [];
if( allTables.length > 0 ) {
for ( var i = 0; i < allTables.length; i++ ) {
var theTable = allTables[i];
$.writeln('***********tables************\n'+theTable);
if ( theTable.rows.length > 1 ) {
var lastRowPage = 0;
lastRowPage = theTable.rows[-1].cells[-1].insertionPoints[-1].parentTextFrames[0].parentPage;
$.writeln(lastRowPage);
thePages.push(lastRowPage.name);
$.writeln(lastRowPage.name);
}
}
}
return thePages;
}
The crucial parts is here:
lastRowPage = theTable.rows[-1].cells[-1].insertionPoints[-1].parentTextFrames[0].parentPage;
This doesn’t work and results to undefined. It works fine with this:
theTable.rows[-1].cells[-1].insertionPoints[-1]
I get an insertion point with all properties, including a parentTextFrames property. But extending to
theTable.rows[-1].cells[-1].insertionPoints[-1].parentTextFrames[0]
I get a text frame reference with no property at all.
Is this a bug? Am I doing something wrong?
Thanks for your kind help,
Tobias
Uwe, this is pretty nasty, puh – thank you very much for pointing this out!
So for completeness sake:
$.writeln( findPagesOfLastCells() );
function findPagesOfLastCells() {
// https://community.adobe.com/t5/indesign-discussions/javascript-property-to-tell-if-text-is-in-a-continued-table/td-p/6379093
var aDoc = app.activeDocument,
allTables = aDoc.stories.everyItem().tables,
thePages = [];
if( allTables.length > 0 ) {
for ( var i = 0; i < allTables.length; i++ ) {
...
Hi @tobias.wantzen , Uwe used the table storyOffset property answering another post this morning, and it seems like it might work here. You can get a table‘s trailing insertionPoint to find which page it ends on. Something like this:
var et = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
alert(findPagesOfLastCells(et))
/**
* Gets the parent page of a table’s end
* @ param a collection of tables
* @ return an array of page names
*
*/
function findPagesOfLastCell
...
Copy link to clipboard
Copied
Hi Tobias,
voted and commented your feature request.
Thanks,
Uwe Laubender
( Adobe Community Professional )
Copy link to clipboard
Copied
Thanks, Uwe! And, yes, geometricBounds and visibleBounds would be nice either.
Feature requests are very frustrating. Years pass and nothing happens. It’s nearly as frustrating as the few new features in new InDesign versions.
To the community it looks, like InDesign’s development is nearly dead.
Kind regards,
Tobias