-
Notifications
You must be signed in to change notification settings - Fork 820
Open
Description
Library version 5.5.1:
cell, having number cell style defined as
#.##0,00 _€;[Red]-#.##0,00 _€
returns
#,##0.00_);[Red](#,##0.00)
on call to cell.getCellStyle().getDataFormatString - it corresponds to built-in style 40 (0x28)
negative values, formatted with this format by call to
DataFormatter.formatRawCellContents
return positive values in round brackets, so the value is effectively corrupted while using streaming event mode with XSSFSheetXMLHandler.
Here is the full code and sample file poi_formatting_problem.xls to reproduce the issue
try (var wb = WorkbookFactory.create(new File("poi_formatting_problem.xls")))
{
//Style (as seen in Excel) #.##0,00 _€;[Red]-#.##0,00 _€
//is converted to #,##0.00_);[Red](#,##0.00)
var sheet = wb.getSheetAt(0);
var row = sheet.getRow(0);
var cell = row.getCell(0);
var str = new DataFormatter().formatRawCellContents(cell.getNumericCellValue(), cell.getCellStyle().getDataFormat(),
cell.getCellStyle().getDataFormatString());
//str is (378.13) instead of -378.13
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels