0

I'm trying to change the color of the rows when the approvaldate is later as today. At that moment, the rows should be colored in Red...Any idea why this code isn't working?

//  Create a row and put some cells in it. Rows are 0 based.
Row = sheet.createRow((short) count);

if(wdContext.nodeRecallStore().getRecallStoreElementAt(i).getApprovaldate().after(today))
//  {
        HSSFCellStyle style = wb.createCellStyle();
        style.setFillBackgroundColor(new HSSFColor.RED().getIndex());
        Row.setRowStyle(style);

// }

1 Answers1

0

This is a little bit confusing, but you have to set the foreground color and a fill pattern.

 final HSSFCellStyle cell = (HSSFCellStyle) workbook.createCellStyle();
    cell .setFillForegroundColor( ... );
    cell .setFillPattern(  CellStyle.SOLID_FOREGROUND );

Updated to CellStyle.SOLID_FOREGROUND

Mirco
  • 2,940
  • 5
  • 34
  • 57