我试图在审批日期更晚时更改行的颜色。在那一刻,行应该用红色着色......任何想法为什么这段代码不起作用?
// 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);
// }
答案 0 :(得分:0)
这有点令人困惑,但您必须设置前景色和填充图案。
final HSSFCellStyle cell = (HSSFCellStyle) workbook.createCellStyle();
cell .setFillForegroundColor( ... );
cell .setFillPattern( CellStyle.SOLID_FOREGROUND );
已更新至CellStyle.SOLID_FOREGROUND