Answered
Script to select cells of a certain width
Is it possible to select all cells of a certain width of 130pt and change to a width of 145pt using a script
Is it possible to select all cells of a certain width of 130pt and change to a width of 145pt using a script
Hi @Summayah5FC7 here's my approach, similar to @virender_CTS but a little different.
- Mark
/**
* @file Find Change Column Width.js
*
* @author m1b
* @version 2025-11-17
* @discussion https://community.adobe.com/t5/indesign-discussions/script-to-select-cells-of-a-certain-width/m-p/15593746
*/
function main() {
// edit these values to suit your needs
const FIND_COLUMN_WIDTH = 130; // points
const CHANGE_COLUMN_WIDTH = 145; // points
const FIND_THRESHOLD = 0.01;
app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;
var doc = app.activeDocument;
var columns = doc.stories.everyItem().tables.everyItem().columns.everyItem().getElements();
var counter = 0;
for (var i = columns.length - 1; i >= 0; i--) {
var column = columns[i];
if (Math.abs(column.width - FIND_COLUMN_WIDTH) > FIND_THRESHOLD)
continue;
column.width = CHANGE_COLUMN_WIDTH;
counter++;
}
alert('Changed ' + counter + ' column widths.');
};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Find Change Column Width');Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.