HSSFCellStyle.setFillBackgroundColor not working
post sample code to reproduce the problem. Also, see the Quick Guide: http://poi.apache.org/spreadsheet/quick-guide.html#FillsAndFrills Yegor
I don't know about version 3.2 but in 3.5 beta 4 the following code (with suitable code around it to create a workbook and save it etc) doesn't create a cell with a light blue background - the background is white. This functionality worked in 3.5 beta 3 (but setting the font as bold didn't work). Font font = wb.createFont(); font.setBoldweight( Font.BOLDWEIGHT_BOLD ); CellStyle style = wb.createCellStyle(); style.setFillBackgroundColor( IndexedColors.LIGHT_BLUE.getIndex() ); style.setFont( font ); Cell cell = row.createCell( 0 ); cell.setCellStyle( style ); cell.setCellValue( "foo" );
You need to set the type of fill pattern. The following snippet of code works fine to me: CellStyle style = wb.createCellStyle(); style.setFillForegroundColor( IndexedColors.LIGHT_BLUE.getIndex() ); style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setFont( font ); Cell cell = row.createCell( 0 ); cell.setCellStyle( style ); cell.setCellValue( "foo" ); See the quick guide: http://poi.apache.org/spreadsheet/quick-guide.html Yegor