https://bz.apache.org/bugzilla/show_bug.cgi?id=69463

            Bug ID: 69463
           Summary: CellUtil.setCellStyleProperties sets the cell
                    background color to black
           Product: POI
           Version: 5.3.0-FINAL
          Hardware: Macintosh
                OS: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: domur...@gmail.com
  Target Milestone: ---

Created attachment 39939
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=39939&action=edit
JUnit 5 test to reproduce the bug

I've attached a JUnit 5 class with two test methods: cellBlackBackgroundBug and
cellBlackBackgroundBugWithCellUtilFork.

Before these tests can be run, the attached input.xlsx must be saved in /tmp.
If you want to use a different directory, you must change the XLSX_DIR constant
in the test class to refer to this location.

----------------------
cellBlackBackgroundBug
----------------------
input.xlsx contains a single sheet with 2 rows and 2 columns. This test copies
the sheet into a new workbook, locks the sheet, unlocks the cells in the second
row, and saves the result as poi-output.xlsx in the aforementioned directory.

If poi-output.xlsx is opened in Excel and a user types in cell A2 all is well,
but when they type in cell B2 the cell background changes to black. This makes
the text impossible to read while typing because the font color is also black.

The corresponding cell in input.xlsx does not turn black while typing.

--------------------------------------
cellBlackBackgroundBugWithCellUtilFork
--------------------------------------
This is identical to the previous test, except for:

1. The result is saved as fork-output.xlsx  
2. A fork of org.apache.poi.ss.util.CellUtil is used. The only difference
between the original and the fork is the removal of the following lines from
CellUtil.setFormatProperties

Short fillForeColorShort = nullableShort(properties, FILL_FOREGROUND_COLOR);
if (fillForeColorShort != null) {
    style.setFillForegroundColor(fillForeColorShort);
}
Short fillBackColorShort = nullableShort(properties, FILL_BACKGROUND_COLOR);
if (fillBackColorShort != null) {
    style.setFillBackgroundColor(fillBackColorShort);
}

If you open fork-output.xlsx in Excel and type in cell B2, the bug no longer
occurs. This indicates that removing these lines from CellUtils would resolve
this issue, but I can't be certain that it wouldn't cause other issues.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to