Monday, January 08, 2007
Blanking those Cell Labels
With a large table (I was working on one that spanned 18 pages, consisting of 399 rows with 7 columns), having all those cell labels is a blessing while you're looking for the overset text, but once that's out of the way, all they do is slow you down and make your document larger, so
//DESCRIPTION: Clear Labels from Every Cell of TableWhich of course raises the issue: is a blank label still present? From a script, you can't tell the difference between a blank label and an absent one, so functionally it makes no difference, but what about internal resources? All I can say is that my document became more responsive after I'd deleted the contents of all the cell labels.
if (app.documents.length == 0 || app.selection.length == 0) { exit() }
processSelection(app.selection[0]);
function processSelection(sel) {
var myTable = findTable(sel);
myTable.cells.everyItem().label = "";
function findTable(obj) {
while (obj.constructor.name != "Table") {
obj = obj.parent;
if (obj.constructor.name == "Application") {
throw "Can't find table"
}
}
return obj
}
}