the singularity of being and nothingness
Posts tagged Excel

CFSpreadsheet Row Striping
Oct 20th
Today I was trying to get CF9’s new spreadsheet functionality to stripe the rows in the spreadsheet I was generating. From what I could find, there’s nothing inherent to the tag (cfspreadsheet) or any of the related functions to do this. I find this a bit curious, but stewing over should-have-been’s doesn’t get the job done. So I decided to roll my own solution.
The first thing to check out is the documentation for the spreadsheetformatrows() function. This takes 3 arguments:
- spreadsheetObj: This is the spreadsheet in which the rows exist
- format: An object of appropriate formatting rules to apply to the selected rows
- row: The rows to which the formatting specification is applied
The “row” argument is the most important. While you can’t specify something like “please stripe the rows with these two formatting objects” (wish list), you can either specify a range of rows (e.g., “3-12”) or a list of rows (e.g., “3,5,7,9”).
Ah, so if we can use a list of rows, the answer becomes apparent: all we have to do is roll through the query and create some lists of odd and even numbers!
To do this, I created a simple function:
function getnumlist(start,end) { // create structure to hold odd and even number lists numbers = structnew(); More >