posted 10 years ago
Hello All,
I have requirement to apply colors to headers in Excel Report. I am poi 3.8v to create cells and applying styles.
In the below fashion I have created style and callingwhen ever required. But it is not working .
private static CellStyle setThinBorder_NoneColor(Workbook wb, DataFormat df) {
HSSFWorkbook hssfwb = (HSSFWorkbook)wb;
HSSFPalette palette = hssfwb.getCustomPalette();
short colorIndex = 45;
palette.setColorAtIndex(colorIndex, (byte)201, (byte)221, (byte)255);
HSSFCellStyle style = ((HSSFWorkbook)wb).createCellStyle();
style.setFillForegroundColor(colorIndex);
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
return style;
}
Can anyone help me how to apply custom colors with POI.
Thanks,
ypk