I'm looking for a way to format tables with AS. I've got the part where you edit the whole table, but I have problem when I want to edit a selection of that table. Let say I have done the basic formating of the table and now I want to highlight some numbers (think annual report tables here). So, I want to put the first row of my selection (the numbers columns) and put it green, then set the character style, then do a tint of that same color on the rest of the selected cells in those columns and set another character style. The thing is, I never know how many columns I'll select, maybe 1, 2, 5, it all depend on the table, and all table don't have the same number of column either.
I can do it for only one column, but it brakes when I try to make it work on multiple columns at once.
Here's the script to make it work on a one column basis. IT's not what I was describing above but you get the idea anyway.
tell application "Adobe InDesign CS3"
tell active document
set mycolor40 to swatch "VERT 127-3-3-C 40%"
set mycolor10 to swatch "VERT 127-3-3-C 10%"
tell text 1 of cells of selection
set applied character style to "TX semibold"
tell cell 1 of selection
set fill color to mycolor40
tell cells 2 thru -1 of selection
set fill color to mycolor10
I've tried with
tell cells of row 1 of selection
and it doesn't work because it affects the whole table and not just the selection. I guess I have to count the column or something like that, but I don't know how exactly to achieve this.