POI 3.12 - XSSF workbook
I am having trouble with spreadsheets created by POI. When I open them in
Excel, they look just fine, but when I try to edit the contents of a cell, I
cannot see the value of the cell, it all turns black. I think it might be
something having to do with the my style, as only cells that I have created,
and therefore added a style to have this issue. Let me be more specific.
On my spreadsheet, if I select a cell with data in it and press F2, the cell
turns black. If I drag the mouse through the cell, it all turns white. I tried
this on a cell where the text is not black, but red. In this case when I press
F2, I can see the red text against the black background of the cell, and if I
drag the mouse through the cell, the text turns light blue on a white
background. Somewhere the "edit" background color is being set to black, but I
don't know how I am doing this.
Unfortunately I am not having this trouble for all of my cells. And to make
matters more difficult, I am using a particular style with two different cells,
and one exhibits the behavior, and the other does not. The only difference
between these two cells is that I am drawing borders around one, and not around
the other. Yet not all of the cells I am drawing a border around have the
problem either.
Anyway, I still believe it has something to do with the style, and how it is
being selected or created. Dozens of styles are created behind the scenes,
exacerbated by the drawing of cell borders, and that could be my problem. But,
I found in styles.xml, a fill that I did not expect. Here is the bad fill:
<fills count="4">
<fill>
<patternFill patternType="none" />
</fill>
<fill>
<patternFill patternType="gray125" />
</fill>
<fill>
<patternFill patternType="solid">
<fgColor indexed="44" />
<bgColor indexed="64" />
</patternFill>
</fill>
<fill>
<patternFill patternType="none">
<bgColor indexed="64" />
</patternFill>
</fill>
</fills>
Every style that used that last fill had the issue, I validated this by
removing the bgColor node from that last fill, and now the spreadsheet is
working as expected. Still not real sure where it came from though. Maybe the
use of the border drawing utility, though I have other cells with borders from
that utility that do not use the faulty fill. Maybe because they already had an
explicit fill assigned to them.
Any idea what I can do to solve this?