Reply To: Define table row heights, column widths in styles somehow?

Home Page / Forums / General InDesign Topics (CLOSED) / Define table row heights, column widths in styles somehow? / Reply To: Define table row heights, column widths in styles somehow?

#56860

This is super-fancy if you need several variants. Save this script as “Resize_Cell Style Name_New Size.jsx”, and it'll pick up the variables from the script name :) (For instance, “Resize_Yellow Cells_10mm.jsx”.)

if (app.activeScript.name.match(/_/g).length == 2)
{
cellStyleName = app.activeScript.name.split('_')[1];
newHeight = app.activeScript.name.split('_')[2].split('.')[0];
if (app.activeDocument.cellStyles.item(cellStyleName).isValid)
app.doScript (sizeRows, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.FAST_ENTIRE_SCRIPT, “Undo Resize Height of “+cellStyleName);
else
alert ('There is no Cell Style named “'+cellStyleName+'”');
} else
alert ('The name “'+app.activeScript.name+'” should be in the format “Resize_CellStyleName_Height.jsx”!');
function sizeRows ()
{
cellarray = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().getElements();
for (a=0; a<cellarray.length; a++)
if (cellarray[a].appliedCellStyle.name == cellStyleName)
cellarray[a].height = newHeight;
}

This article was last modified on August 28, 2010

Comments (0)

Loading comments...