// Aqua background
CellStyle style = wb.createCellStyle();
style.setFillBackgroundColor(HSSFColor.AQUA.index);
style.setFillPattern(CellStyle.BIG_SPOTS);
Cell cell = row.createCell((short) 1);
cell.setCellValue(new XSSFRichTextString("X"));
cell.setCellStyle(style);
// Orange "foreground", foreground being the fill foreground not the font color.
style = wb.createCellStyle();
style.setFillForegroundColor(HSSFColor.ORANGE.index);
style.setFillPattern(CellStyle.SOLID_FOREGROUND);
cell = row.createCell((short) 2);
cell.setCellValue(new XSSFRichTextString("X"));
cell.setCellStyle(style);
// Write the output to a file
FileOutputStream fileOut = new FileOutputStream("fill_colors.xlsx");
wb.write(fileOut);