Created attachment 36159 [details] example of problem I'm using the following code to set the background color for cells: XSSFCellStyle cellStyle = (XSSFCellStyle) excelStyle.getCellStyle(); cellStyle.setFillForegroundColor(new XSSFColor(new byte[]{(byte) 14, (byte) 173, (byte) 108}, new DefaultIndexedColorMap())); cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); But I'm always getting black background for a merged cell. Also, I've tried this way: cellStyle.setFillForegroundColor(new XSSFColor(java.awt.Color.decode("#0ead6c"))); but this same result. It works only if I'm using IndexedColors like: cellStyle.setFillForegroundColor(IndexedColors.CORAL.index); Additional info: SXSSFWorkbook poi:3.17 poi-ooxml:3.17
seems that problem is in org.apache.poi.ss.util.RegionUtil#setBorderTop if I apply style in this order, then it's ok: 1. merge cells 2. set border for merge region 3. set background color for merged cell