Doing some spreadsheet work for accounting types who like pretty formatting and the right colors, I soon encountered a limitation with ColdFusion 9’s built in spreadsheet functionality. Namely, the predefined list of colors available for various stylings…
In there you get such beauties as, ‘lemon_chiffon’ and ‘light_cornflower_blue’, but no options to pass in a hex color. Bizarre you say? Damn right.
Defenders might jump in to blame the underlying tech, Apache POI, but that’s not quite fair - POI provides methods for creating custom palettes, the CF implementation just didn’t hook into it, missing an opportunity for some lovely API abstraction (though they achieved plenty of other good stuff).
Flicking franticly through the documentaion of POI, I stumbled on the ‘setColorAtIndex()’ method which I figured meant I could override the colors in the predefined palette. A single google later and I unexpectedly found myself at a ColdFusion blog who’s author had thought the exact same thing and came up with some working code, l33t: