the last couple of scripting lessons (#30 & #31) showed a couple of examples of how to use applescript to assist with reformatting an existing table. but if you are setting up your own tables you’d use table and cell styles to make your life a little easier.
as with paragraph, character and object styles — if you are going to use particular formatting settings more than once in a document, it’s smart to create a style for those settings. so, if your document has several tables with similar formatting, you’d create a table style. this example only has one table, so we’ll just look at cell styles.
when we first change our text to a table it will look something like this :
then we start to create the table formatting we want :
to create the cell style for the reversed row, highlight that row and then choose “New Cell Style…” from the flyout menu on the cell styles panel (windows > styles > cell styles) :
you can also access this functionality directly from your control panel :
the new style takes on the formatting of the selected cells. we’re calling that style ‘header row’ and you can see that, as well as the colour of the cells, the cell style will also apply a paragraph style to the text in those cells. that is, the paragraph style does not need to be applied separately — it’s part of the cell style :
then repeat the process for each different cell type. for this table we’ve created three different cell styles :
the easiest way to proceed from here is to first apply the most common style to the entire table. to select every cell in a table, first place your cursor somewhere within the table and then move your mouse to the top left corner of the table until you see a downward pointing arrow, then click.
here we’ve applied the ‘basic row’ style to the entire table by clicking that style in the cell styles panel (or from the control panel dropdown) :
then go through and apply the other styles to their relevant cells (here we’re doing entire rows in the same style) :
now here’s why you’ve gone to all that trouble … when the client comes back and says they want all the reversed rows to be thicker and all the blank rows to be thinner (or any of a gazillion other possible alterations), you don’t have to change each row individually (or use applescript) you just change the cell styles. unfortunately InDesign does not yet allow you to specify a specific cell height in the cell style (who knows why), but you CAN change the spacing — or cell insets. here we’re changing the top and bottom insets for the ‘header row’ style from 1mm to 2mm :
and like magic the entire table is updated automatically :
so, if you’re working with tables but not using cell styles, you’re probably working way too hard.