Reply To: Table script for setting var column widths

#84786
Ari Singer
Member

This is JavaScript.

I’m afraid you included his comments in the script, without ‘commenting it out’. The script should look like this:


// Number of columns in a table may vary depends on the book.
// If the columns count is constant then you can use the below script.
var myDoc = app.activeDocument;
var myWidths = [100, 100, 150, 150];
for(var T=0; T < myDoc.textFrames.length; T++){
for(var i=0; i < myDoc.textFrames[T].tables.length; i++){
for(var j=0; j < myWidths.length; j++){
myDoc.textFrames[T].tables[i].columns[j].width = myWidths[j];
}
}
}
alert(“Table width updated successfully…”);
// In the above script i declared the 4 columns width(s) as 100pt, 100pt, 150pt & 150pt. Change width acording to your requirement.
// I think this will give you the solution.

Make sure to save it as a .jsx file and place it in the Scripts panel and run it from there.

This article was last modified on May 11, 2016

Comments (0)

Loading comments...