Anyway, in JavaScript it is quite easy to make modifications by intuition -- even for those who are unfamiliar with coding.
Here's another version. You can select either the whole table, or one or more cells
var scriptName = "Table",
doc;
app.doScript(PreCheck, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "\"" + scriptName + "\" script");
//===================================== FUNCTIONS ======================================
function Main() {
if (app.selection[0].constructor.name == "Table") {
var cells = app.selection[0].cells.everyItem().getElements();
for (var i = 0; i < cells.length; i++) {
ProcessCell(cells);
}
}
else {
ProcessCell(app.selection[0]);
}
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------
function ProcessCell(cell) {
cell.texts[0].pointSize = "7 pt";
cell.texts[0].leading = "8 pt";
cell.texts[0].tracking = 0;
cell.texts[0].kerningValue = 0;
cell.leftInset = cell.rightInset = "1 mm";
cell.topInset = cell.bottomInset = "0.5 mm";
cell.verticalJustification = VerticalJustification.CENTER_ALIGN;
cell.autoGrow = true;
cell.minimumHeight = "3.75 mm";
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------
function PreCheck() {
if (app.documents.length == 0) ErrorExit("Please open a document and try again.", true);
doc = app.activeDocument;
if (doc.converted) ErrorExit("The current document has been modified by being converted from older version of InDesign. Please save the document and try again.", true);
if (!doc.saved) ErrorExit("The current document has not been saved since it was created. Please save the document and try again.", true);
if (app.selection.length == 0) ErrorExit("Nothing is selected, Select some cells and try again.", true);
if (app.selection[0].constructor.name != "Cell" && app.selection[0].constructor.name != "Table") ErrorExit("Select a table, or one or more cells and try again.", true);
Main();
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------
function ErrorExit(error, icon) {
alert(error, scriptName, icon);
exit();
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------