Reputation: 47
I'm looking for a way to set the color of the background of an Excel worksheet using Java's Apache POI
Thanks!
Upvotes: 2
Views: 2224
Reputation: 1210
HSSFCellStyle cellStyle = workBook.createCellStyle();
style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
style.setFillPattern(CellStyle.SOLID_FOREGROUND);
cell.setCellStyle(style);
Upvotes: 0
Reputation: 3311
Try XSSFSheet.setTabColor from the POI Documentation
Edited:
You may need to apply it to each cell / row style.
How to apply background color for the rows in excel sheet using Apache POI?
Another similar example/better explanation here:
excel poi: apply foreground color to blank cells
Upvotes: 1