Please check the detailed article
on how to set the background color of the cell. Following code sets the cell A1 background color to yellow of worksheet sheet2.
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Accessing the added worksheet in the Excel file
int sheetIndex = workbook.getWorksheets().add();
Worksheet worksheet = workbook.getWorksheets().get(sheetIndex);
Cells cells = worksheet.getCells();
//Accessing the “A1” cell from the worksheet
Cell cell = cells.get(“A1”);
Style style = cell.getStyle();
//Setting the cell color to yellow
//Setting the background pattern to vertical stripe
//Saving the modified style to the “A1” cell.
//Saving the Excel file