Answered
In a script, I'm trying to assign a table style, but getting it by name doesn't work.
The style exists, and if I examine it with .name ==, it matches.
But getByName does not. In the code below, it's getByName that's throwing an exception, but the part that raises the "style found" alert works:
function styleTable(theTable)
{
var tableStyleName = "Section heading";
theTable.cells.everyItem().clearCellStyleOverrides(true);
for(i = 0; i < app.activeDocument.tableStyles.length; i++)
{
if(app.activeDocument.tableStyles[i].name == tableStyleName)
{
alert("Style found");
}
}
try
{
var tableStyle = app.activeDocument.tableStyles.getByName(tableStyleName);
theTable.appliedTableStyle = tableStyle;
}
catch(err)
{
alert("Table style " + tableStyleName + " not found.");
return;
}
}

