Richie Episcopo Richie Episcopo - 1 year ago 100
Java Question

Can't Set Fill Color Apache POI Excel Workbook

I have scanned this forum over and over and tried every method mentioned on here and still can't get Apache POI to change to fill background color of my excel document.

Here is my code:

errorOccured = true;
XSSFCellStyle cs = workbook.createCellStyle();

Do you know why this wouldn't work? What is the correct way to get
to be filled with red (background color)?

Thank you!

Answer Source

Use forground color instead of Background color.

 errorOccured = true;
 XSSFCellStyle style = workbook.createCellStyle();

this will fill the cell background color with RED.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download