Copy link to clipboard
Copied
Hi InDesign Expert,
I am facing issue with column overflows return false, while cell overflows is working fine. Can anyone explain why?
var doc = app.documents.item(0);
var tf = app.selection[0];
var tbl = tf.tables[0];
var i;
for(i=tbl.columns.length-1; i>=0; --i){
var col = tbl.columns[i];
while(col.overflows) {
col.width++;
doc.recompose();
}
}
Note: I do not want use cell.overflows because table has arournd 4000+ rows.
Regards,
Sumit
Ok, I did look into this a bit more and I stand corrected. It seems it returns true only if the first cell in the column is overset, no other cells state is being taken into consideration.
-Manan
Hi,
You could check all the cells (fairly quickly, I haven't tried with a 4000+ table, only with a 200 cell), you could use this.
var a = app.activeDocument.pageItems[0].tables[0].cells.everyItem().overflows.toString();
if (a.indexOf('true') != -1){
// it overflows.
}
(you would need to do more investigation to find out which cell is overset, but would let you know there is one)
Obviously you would need to add for each table you want to and for each document, this only checks
...Copy link to clipboard
Copied
Based on my investigation I see that the column overflow returns true only if all the cells in the column are overflowing or are empty. As soon as any cell gets its overset resolved, the return is false and that is what must be happening with you.
-Manan
Copy link to clipboard
Copied
Yes and Thank you Manan,
But I think 'column.overflows' ruturn true if any cells get overflow.
Sumit
Copy link to clipboard
Copied
Ok, I did look into this a bit more and I stand corrected. It seems it returns true only if the first cell in the column is overset, no other cells state is being taken into consideration.
-Manan
Copy link to clipboard
Copied
Hi,
You could check all the cells (fairly quickly, I haven't tried with a 4000+ table, only with a 200 cell), you could use this.
var a = app.activeDocument.pageItems[0].tables[0].cells.everyItem().overflows.toString();
if (a.indexOf('true') != -1){
// it overflows.
}
(you would need to do more investigation to find out which cell is overset, but would let you know there is one)
Obviously you would need to add for each table you want to and for each document, this only checks the active document and the first page item and the first table in that page item, but I hope it gives the idea.
Regards
Malcolm
Copy link to clipboard
Copied
Thank you BarlaeDC, I was using this logic except .toString() method and it saves time compare to every cell overflows.