We are trying to upgrade our POI implementation from 3.9 version to 3.10.1, when doing so we encountered the below problem. Excel fraction value getting converted incorrectly in csv file. Sample input Cell format in Excel : Fraction - Up to one digit (1/4) Cell value in Excel : 44022813230178 Displayed value in Excel : 44022813230178 In Apache POI 3.9 version converted csv file for the about input file is POI 3.9 csv file value : 44022813230178 Where as in POI 3.10-FINAL and 3.10.1 versions the output is incorrect POI 3.10.1 and 3.10-FINAL csv value : 2147483647 Java code used formatter = new DataFormatter(true); csvLine.add(formatter.formatCellValue(cell)); When i debug into the code of org.apache.poi.ss.usermodel.FractionFormat class, in the method format(Number num) I see a possible bug. The double value is getting converted into 'int'. In the line number 123, sb.append(Integer.toString((int)wholePart)); there are multiple palaces where its converted to 'int'.
Can you retry with 3.11 beta 3? (Should be on all popular mirrors + maven central within the next 12 hours) Also, it'd be helpful to know what POI thinks the format string is that applies to the problematic cell
I even tried with 3.11-beta2 (as that's the latest maven available), still getting the same result as 3.10-FINAL. The format string POI applies to that cell is : # ?/? Will wait for 3.11-beta3 version and update the same.
Thank you for submitting this issue. Y, we should switch to long, and we may need to convert the fraction calculation to BigDecimal, iirc. I should have a patch by the end of the week.
Please state if this is still a problem on 3.14 or latest trunk.
No update for several months, thus I am closing this as WORKSFORME for now, please reopen this bug if there is still a problem with a current version of POI.