Highlighted

column overflows return false

Contributor ,
Sep 14, 2020

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?table-overflow.PNGtable-overflow-output.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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

Adobe Community Professional
Correct answer by BarlaeDC | Adobe Community Professional

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

Topics

Scripting, Server developers

Views

56

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

column overflows return false

Contributor ,
Sep 14, 2020

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?table-overflow.PNGtable-overflow-output.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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

Adobe Community Professional
Correct answer by BarlaeDC | Adobe Community Professional

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

Topics

Scripting, Server developers

Views

57

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Sep 14, 2020

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Contributor ,
Sep 14, 2020

Copy link to clipboard

Copied

Yes and Thank you Manan,
But I think 'column.overflows' ruturn true if any cells get overflow.

Sumit

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Sep 14, 2020

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Sep 14, 2020

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Contributor ,
Sep 15, 2020

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...