Hi-
Does anyone know how InDesign CS3 [or other] assigns cell id when creating a table? I’ve encountered apparently different schemes when I vary column number and hold number of rows constant. For example, if I have a two-row table (no header) the following cell IDs are given for a 5-column 2 row table:
0 1 2 3 16
4 5 6 7 17
Now if I make it a 7-column 2-row table, the numbering changes:
0 1 2 3 16 17
4 5 6 7 18 19
And an 8-column, 2-row table:
0 1 2 3 16 17 18
4 5 6 7 19 20 21
Thanks,
Ralph
Hi. If you’d created your finished table arrangement using the insert table menu, they would be in logical order. You added a 5th column outside that dialog; the original values got preserved and the new ones were flowed at the end in their creation order. Given the missing range, it looks like you may also have deleted columns at some point. It would be more reliable to use absolute positions rather than IDs (i.e., cell 1:1).
The tables were created independently with the following subroutine, varying the numbers of rows:
to makeTable(zz, yy, aa, xx) -- #rows, #columns, #header rows, insertion point
tell application "Adobe InDesign CS3"
tell xx
set theTable to make table
set header row count of theTable to aa as integer
set column count of theTable to yy as integer
set body row count of theTable to zz as integer
end tell
end tell
return theTable
end makeTable
I realize that adding cells post-hoc results in different numbering. My goal is to be able to create a table programmatically, with varying numbers of cells, and then style the cells based on their CELL ID.
I realize I can also refer to cells by ROW and COLUMN but that causes other code structure issues.
Thanks,
Ralph
Your handler adds and deletes from the default table that’s generated by the unqualified “make table” statement. The table element’s attribute styling needs to be done along with the make event.
“make table with properties {column count:5, body row count:2}”
Brilliant. That works.
Result of first test yields proper behavior.
0 1 2 3 4
5 6 7 8 9
Thanks Mark!
-Ralph