Question
CS3 [JS] Speed Issues with Table Formating
Hi there
Please find below an excerpt from my table formatting script. Script as such runs perfectly and does its job well. But it's quite slow thanks to the "formatTable" function (at least that's what Extend Script profiler says).
What I want it to do is to set the same border for each cell. In its current state it takes it three to five minutes to crunch through 300 rows.
So I naturally started to wonder whether I'm really doing it the most clever way.
Thanks for Help
function formatTable(){
//~ myTable.cells.everyItem().bottomEdgeStrokeType="Solid";
//~ myTable.cells.everyItem().topEdgeStrokeType="Solid";
//~ myTable.cells.everyItem().leftEdgeStrokeType="Solid";
//~ myTable.cells.everyItem().rightEdgeStrokeType="Solid";
//~ myTable.cells.everyItem().bottomEdgeStrokeWeight=".25pt";
//~ myTable.cells.everyItem().topEdgeStrokeWeight=".25pt";
//~ rightEdgeStrokeWeight=0;
//~ myTable.cells.everyItem().leftEdgeStrokeWeight=0;
for (i=myTable.rows.length;i>0;i--){
focus = myTable.rows[i-1].cells.everyItem();
with (focus){
bottomEdgeStrokeType="Solid"; topEdgeStrokeType="Solid"; leftEdgeStrokeType="Solid"; rightEdgeStrokeType="Solid";
bottomEdgeStrokeWeight=".25pt"; topEdgeStrokeWeight=".25pt"; rightEdgeStrokeWeight=0; leftEdgeStrokeWeight=0;
}
$.writeln("Formating Table: " + i + "/" + myTable.rows.length);
}
* myTable is a reference to processed table
** I've included both (equally slow) approaches, one being commented out
Please find below an excerpt from my table formatting script. Script as such runs perfectly and does its job well. But it's quite slow thanks to the "formatTable" function (at least that's what Extend Script profiler says).
What I want it to do is to set the same border for each cell. In its current state it takes it three to five minutes to crunch through 300 rows.
So I naturally started to wonder whether I'm really doing it the most clever way.
Thanks for Help
function formatTable(){
//~ myTable.cells.everyItem().bottomEdgeStrokeType="Solid";
//~ myTable.cells.everyItem().topEdgeStrokeType="Solid";
//~ myTable.cells.everyItem().leftEdgeStrokeType="Solid";
//~ myTable.cells.everyItem().rightEdgeStrokeType="Solid";
//~ myTable.cells.everyItem().bottomEdgeStrokeWeight=".25pt";
//~ myTable.cells.everyItem().topEdgeStrokeWeight=".25pt";
//~ rightEdgeStrokeWeight=0;
//~ myTable.cells.everyItem().leftEdgeStrokeWeight=0;
for (i=myTable.rows.length;i>0;i--){
focus = myTable.rows[i-1].cells.everyItem();
with (focus){
bottomEdgeStrokeType="Solid"; topEdgeStrokeType="Solid"; leftEdgeStrokeType="Solid"; rightEdgeStrokeType="Solid";
bottomEdgeStrokeWeight=".25pt"; topEdgeStrokeWeight=".25pt"; rightEdgeStrokeWeight=0; leftEdgeStrokeWeight=0;
}
$.writeln("Formating Table: " + i + "/" + myTable.rows.length);
}
* myTable is a reference to processed table
** I've included both (equally slow) approaches, one being commented out