Copy link to clipboard
Copied
Is there a way of coloring a table or cell a swatch color in one shot without having to go through: bottomEdgeStrokeColor = myColor, topEdgeStrokeColor = myColor, leftEdgeStrokeColor = myColor, rightEdgeStrokeColor = myColor?
Not the end of the world if not but would be nice
I got it.
It's useful if you have a lot of styles with the same stroke color or other property
Thanks for the giveaway clue
...myDoc = app.activeDocument;
myColor = app.activeDocument.swatches.item("C=0 M=100 Y=0 K=0");
magentaStroke = {bottomEdgeStrokeColor:myColor, topEdgeStrokeColor:myColor, leftEdgeStrokeColor:myColor, rightEdgeStrokeColor:myColor}; // sets all edges to color
myColor = app.activeDocument.swatches.item("C=100 M=0 Y=0 K=0");
cyanStroke = {bottomEdgeStrokeColor:myColor, topEdgeStrokeCol
Copy link to clipboard
Copied
There aren't that many advantages to try and do lots of stuff in one line (and disadvantages include readability and maintainability), but there you go:
myTable = app.selection[0].parentStory.tables[0];
myColor = app.activeDocument.swatches.item("red");
myTable.cells.everyItem().properties = {bottomEdgeStrokeColor:myColor, topEdgeStrokeColor:myColor, leftEdgeStrokeColor:myColor, rightEdgeStrokeColor:myColor};
Copy link to clipboard
Copied
HiJongware,
Thanks for you quick reply, for some reason I didn't get the Email notification.
I was thinking more of using a variable for use with the "with" command.
something like
myStokeColors = "
bottomEdgeStrokeColor = myColor; topEdgeStrokeColor = myColor; leftEdgeStrokeColor = myColor; rightEdgeStrokeColor = myColor";
myCellStyle = myDoc.cellStyles.add({name:"myCellStyle"});
with (myCellStyle){
appliedParagraphStyle = "myParaStyle";
bottomInset =1;
myStokeColors;
}
any ideas?
Copy link to clipboard
Copied
I got it.
It's useful if you have a lot of styles with the same stroke color or other property
Thanks for the giveaway clue
myDoc = app.activeDocument;
myColor = app.activeDocument.swatches.item("C=0 M=100 Y=0 K=0");
magentaStroke = {bottomEdgeStrokeColor:myColor, topEdgeStrokeColor:myColor, leftEdgeStrokeColor:myColor, rightEdgeStrokeColor:myColor}; // sets all edges to color
myColor = app.activeDocument.swatches.item("C=100 M=0 Y=0 K=0");
cyanStroke = {bottomEdgeStrokeColor:myColor, topEdgeStrokeColor:myColor, leftEdgeStrokeColor:myColor, rightEdgeStrokeColor:myColor};
try {myCellStyleMagenta = myDoc.cellStyles.add({name:"myCellStyleMagenta"});}
catch (exist) {myCellStyleMagenta = myDoc.cellStyles.item("myCellStyleMagenta");}
with (myCellStyleMagenta){
bottomInset =1;
properties = magentaStroke; // applies color to cell style
}
try {myCellStyleCyan = myDoc.cellStyles.add({name:"myCellStyleCyan"});}
catch (exist) {myCellStyleCyan = myDoc.cellStyles.item("myCellStyleCyan");}
with (myCellStyleCyan){
bottomInset =1;
properties = cyanStroke;
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now