1

After searching i found a solution on stackoverflow:

Refering to this Setting foreground color for HSSFCellStyle is always coming out black

csFirstRow.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
csFirstRow.setFillPattern(CellStyle.SOLID_FOREGROUND);

But it seems to have no effect.

Reading and searching google / Poi Docs desnt help.

How to Colorize a Cell using apache Poi?

Community
  • 1
  • 1
MemLeak
  • 4,456
  • 4
  • 45
  • 84

1 Answers1

4

It seems to be unnessecary to set the Fill Background. It requires the "fillPattern"

csFirstRow.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
csFirstRow.setFillPattern(CellStyle.SOLID_FOREGROUND);

as javadoc says (setFillPattern)

setting to one fills the cell with the foreground color... No idea about other values

Now it works as it should

thanks to this helpfull answer on stackoverflow

Community
  • 1
  • 1
MemLeak
  • 4,456
  • 4
  • 45
  • 84