Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

column overflows return false

Engaged ,
Sep 14, 2020 Sep 14, 2020

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

-Sumit
TOPICS
Scripting
663
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Sep 14, 2020 Sep 14, 2020

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

Translate
Community Expert , Sep 14, 2020 Sep 14, 2020

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

...
Translate
Community Expert ,
Sep 14, 2020 Sep 14, 2020

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 14, 2020 Sep 14, 2020

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

Sumit

-Sumit
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 14, 2020 Sep 14, 2020

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 14, 2020 Sep 14, 2020

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 15, 2020 Sep 15, 2020
LATEST

Thank you BarlaeDC, I was using this logic except .toString() method and it saves time compare to every cell overflows.

-Sumit
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines