Reputation: 171
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?
Upvotes: 4
Views: 5754
Reputation: 178323
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));
Upvotes: 7