Copy link to clipboard
Copied
Ive setup a document in where i use linked excel sheets to fill tables. Each column has it cellStyle, ive pre applied these so i have each and every other gets a light grey color and the left column has white line on the right. Now sometimes when i need to update the table, somehow the columns loose the cellStyle. I dont understand why or whats happening. But reapplying them manual is tedious ofcourse.
Ive tried look at some scripts and have managed to pull of some parts as column with etc. But applying the cellStyle per column i keep getting a error
cellStyleName = ["Product - Row 1", "Product - Row 2", "Specs - Row 1", "Specs - Row 2"]
//newHeight = app.activeScript.name.split('_')[2].split('.')[0];
cellWidth = ["108", "105", "25", "54"]
cellColor = ["Red", "Red", "Red", "Red"]
//cellnames = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().getElements();
for (b = 0; b < cellStyleName.length; b++)
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 + '"');
function colorColumn() {
columnarray = app.activeDocument.stories.everyItem().tables.everyItem().columns;
for (i = 0; i < columnarray.length; i++) {
// alert(columnarray);
if (i == 1)
alert(a);
columnarray.fillColor = "Red";
if (i == 2)
alert(a);
columnarray.fillColor = "Red";
// columnarray.appliedCellStyle.name = cellStyleName;
}
}
function sizeRows() {
cellarray = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().getElements();
columnarray = app.activeDocument.stories.everyItem().tables.everyItem().columns;
// for (i = 0; i < columnarray.length; i++) {
// // alert(columnarray);
// alert(i);
// columnarray.fillColor = "Red";
// // columnarray.appliedCellStyle.name = cellStyleName;
//
// }
// cellEmpty = app.activeDocument.stories.everyItem().tables.everyItem()
// table = app.activeDocument.stories.everyItem().tables;
// for (i = 0; i < table.cells.length; i++) {
// if (table.cells.texts[0].length == 0)
// table.cells.fillColor = 'Red';
// }
for (a = 0; a < cellarray.length; a++)
colorColumn(a);
if (cellarray.appliedCellStyle.name == cellStyleName)
cellarray.width = cellWidth;
else if (cellarray.appliedCellStyle.name == "[None]")
cellarray.appliedCellStyle = cellStyleName;
// columnarray.fillColor = "Red";
}
Copy link to clipboard
Copied
Which Adobe application are you using? Acrobat (PDF) ... or ... ?
Neil
Copy link to clipboard
Copied
Owww, didnt this got into indesign section?
It's indesign