I'm using 3.14. -Anders
On 2 May 2016 at 16:35, Javen O'Neal <[email protected]> wrote: > What version of POI are you using? > On May 2, 2016 03:25, "Anders Åberg" <[email protected]> wrote: > > > Hi guys > > I am trying to set RGB background colors on cells and in addition set > > borders on regions using RegionUtil. When doing this, all the cells with > > borders end up completely black. > > > > It seems that using XSSFColor on XSSFCellStyle causes problems with the > way > > CellUtil.setCellStyleProperties works. CellUtil is used by RegionUtil. > > > > This is a minimal test to reproduce the problem: > > > > XSSFWorkbook workbook = new XSSFWorkbook(); > > XSSFSheet sheet = workbook.createSheet(); > > > > Cell cell = CellUtil.getCell(CellUtil.getRow(0, sheet), 0); > > > > XSSFColor color = new XSSFColor(Color.RED); > > XSSFCellStyle style = workbook.createCellStyle(); > > style.setFillForegroundColor(color); > > style.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND); > > cell.setCellStyle(style); > > > > // Everything is fine at this point, cell is red > > > > Map<String, Object> properties = new HashMap<>(); > > properties.put(CellUtil.BORDER_BOTTOM, CellStyle.BORDER_THIN); > > CellUtil.setCellStyleProperties(cell, properties); > > > > // Now the cell is all black > > > > Does anybody know if this is supposed to work? Any suggestions on > > workarounds? It is of course possible to avoid the CellUtil methods, but > > they contain some clever logic to avoid creating new styles for every > cell > > and eventually hit a threshold in Excel. > > > > All help will be very appreciated! > > > > Thanks, Anders > > >
