views:

289

answers:

1

I'm trying to set Excel cell colors using Apache POI in Java. I played around in Excel itself and chose the colors I wanted - but I can't figure out how to use those colors with POI. I'm using the font.setColor method, which takes a short that's the index of a color... Which seems to indicate that I'm limited to the constants in IndexedColors. Is there any way to set a cell to a hex color value? Or can I only use the predefined constants?

+1  A: 

You can use the HSSFPalette class to query the defined colors and define your own colors as well (using setColorAtIndex()).

Joachim Sauer
Is there any way to do this without replacing the default colors?
froadie