I have been adding background as shown below. All other changes are seen in the excel but cell does not get filled with the color. please help
public static CellStyle getWeeklyHeaderStyle(HSSFWorkbook wb) {
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setWrapText(true);
cellStyle.setAlignment((short) 1);
cellStyle.setVerticalAlignment((short) 1);
cellStyle.setBorderLeft((short) 1);
cellStyle.setBorderRight((short) 1);
cellStyle.setBorderTop((short) 1);
cellStyle.setBorderBottom((short) 1);
getPalette(wb);
cellStyle.setFillBackgroundColor(IndexedColors.RED.getIndex());
cellStyle.setFont(getFont(wb));
return cellStyle;
}
public static HSSFPalette getPalette(HSSFWorkbook wb) {
HSSFPalette palette = wb.getCustomPalette();
// replacing the standard red with freebsd.org red
palette.setColorAtIndex(IndexedColors.RED.index, (byte) 204, (byte) 204,
(byte) 255);
return palette;
}