How can we add custom colors (HEX or RGB) to a SXSSFWorkbook? I found multiple implementations where everyone used HSSFPalette to change the custom palette of a HSSFWorkbook. But unlike HSSFWorkbook, SXSSFWorkbook doesn't have a getCustomPalette call and therefore I couldn't get any palette to override. Any pointers?
Asked
Active
Viewed 5,530 times
4
-
please refer to this link. a similar question. http://stackoverflow.com/questions/20561710/using-custom-colors-with-sxssf-apache-poi – gaurav5430 Dec 13 '13 at 11:21
1 Answers
7
An SXSSFWorkbook
is a wrapper around a XSSFWorkbook
. Because it's just XSSF
, you can directly create an XSSFColor
with any RGB you want. You don't need to override any palette.
XSSFColor customColor = new XSSFColor(new byte[] {alpha, red, green, blue});
You can also pass a java.awt.Color
if you want.
XSSFColor anotherColor = new XSSFColor(new java.awt.Color(red, green, blue, alpha));

rgettman
- 176,041
- 30
- 275
- 357