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?
views:
289answers:
1
+1
A:
You can use the HSSFPalette
class to query the defined colors and define your own colors as well (using setColorAtIndex()
).
Joachim Sauer
2010-02-22 17:59:49
Is there any way to do this without replacing the default colors?
froadie
2010-02-22 18:34:43