0

I have a big cell style problem with poi and XSSF.

excel xample

EDIT 2015-01-06:

The green cell has a design color und the blue cell a standard color. The standard color works good, but the design color only works with HSSF. How can i get the design color of a cell?

thx for help

EDIT 2015-01-07: Here is a simple example to get the colors

HSSF

hssfSheet.getRow(0).getCell(1).getCellStyle().getFillForegroundColor() == 40
hssfSheet.getRow(1).getCell(1).getCellStyle().getFillForegroundColor() == 42
hssfSheet.getRow(2).getCell(1).getCellStyle().getFillForegroundColor() == 64

XSSF

xssfSheet.getRow(0).getCell(1).getCellStyle().getFillForegroundColor() == 0
xssfSheet.getRow(1).getCell(1).getCellStyle().getFillForegroundColor() == 64
xssfSheet.getRow(2).getCell(1).getCellStyle().getFillForegroundColor() == 64

I believe that 0 means it has a color and 64 there is no color.

xssfSheet.getRow(0).getCell(1).getCellStyle().getFillForegroundXSSFColor() instanceof XSSFColor
xssfSheet.getRow(1).getCell(1).getCellStyle().getFillForegroundXSSFColor() == null
xssfSheet.getRow(2).getCell(1).getCellStyle().getFillForegroundXSSFColor() == null

I can't get the color information of an XSSF-File if the cell has a design color like this green in (1,1).

Smoothi
  • 283
  • 1
  • 3
  • 15

0 Answers0