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

            Bug ID: 60845
           Summary: copied cell style and CF
           Product: POI
           Version: 3.15-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Two equal XLSX Files
Both are using conditional Formatting of the Background Color on e.g. Column 1
Now, copy one Row of File1 to File2 using:

for (int i = 0; i < sourceRow.getLastCellNum(); i++) {

    XSSFCellStyle newStyle = destSheet.getWorkbook().createCellStyle();
    newStyle.cloneStyleFrom(oldCell.getCellStyle());      
    newCell.setCellStyle(newStyle);


    // Set the cell data type
    newCell.setCellType(oldCell.getCellType());

    // Set the cell data value
    switch (oldCell.getCellType()) {
    case Cell.CELL_TYPE_BLANK:
        newCell.setCellValue(oldCell.getStringCellValue());
        break;
    case Cell.CELL_TYPE_BOOLEAN:
        newCell.setCellValue(oldCell.getBooleanCellValue());
        break;
    case Cell.CELL_TYPE_ERROR:
        newCell.setCellErrorValue(oldCell.getErrorCellValue());
        break;
    case Cell.CELL_TYPE_FORMULA:
        newCell.setCellFormula(oldCell.getCellFormula());
        break;
    case Cell.CELL_TYPE_NUMERIC:
        newCell.setCellValue(oldCell.getNumericCellValue());
        break;
    case Cell.CELL_TYPE_STRING:
        newCell.setCellValue(oldCell.getRichStringCellValue());
        break;
    }
}

The Row is copied, the values, the size, also the background colors and so on.
But the conditional formatting does not longer work for the
copied rows. "Not working" means: the cells background is white, even if the
value is the right one.

If you use the cell formatting options (in excel) and simply click on "No
Color" for Filling (which is already selected), and confirm it with OK, it
works.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to