Legend
September 11, 2025
Answered
How to Select some cells in a table column except the header and footer rows using a script?
- September 11, 2025
- 3 replies
- 824 views
Scenario 1: When the cursor is in a cell, select the entire column of the table (excluding the table header and footer).
Scenario 2: When text is selected within a cell, executing the script will select all cells in this column of the current frame (excluding the header and footer rows).
@Robert at ID-TaskerLong time no see. What big things have you been up to lately?
He wrote a piece of code that selects based on matching styles, but sometimes the cell styles might differ, so it doesn't work.
app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, "To Layout! …");
function main() {
// Place the Cursor in any Cell:
var myCell = app.selection[0].parent;
var myCellStyle = myCell.appliedCellStyle;
var myColumnCells = myCell.parentColumn.cells;
var C = myColumnCells.length, c;
var myCounter = 0;
var StartRow = 0;
var EndRow = 0;
for (c = 0; c < C; c++) {
// alert(c);
if (myColumnCells[c].appliedCellStyle === myCellStyle) {
if (StartRow) {
}
else {
StartRow = c;
};
}
else {
if (StartRow) {
EndRow = c;
break;
};
};
};
if (StartRow > 0 && EndRow == 0) {
EndRow = c;
};
if (StartRow > 0 && EndRow > 0) {
app.select(myCell);
app.select(myCell.parent.cells.itemByRange(myColumnCells[StartRow], myColumnCells[EndRow - 1]));
};
};

