Bug 53859 - DataFormatter Numeric cell value extra digits
Summary: DataFormatter Numeric cell value extra digits
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.8-FINAL
Hardware: PC Windows Vista
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2012-09-12 12:10 UTC by Sebas
Modified: 2016-01-22 05:09 UTC (History)
0 users

Contains the described formula (7.14 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2012-09-18 14:56 UTC, Sebas

Note You need to log in before you can comment on or make changes to this bug.
Description Sebas 2012-09-12 12:10:37 UTC
Type 1612.44/3600 in a cell, Excel displays 0.4479, the stored value is 


DataFormatter will show 0.44790000000000002 instead of 0.4479

To verify that it was not a problem in my code I have run the example org.apache.poi.xssf.eventusermodel.XLSX2CSV, the behavior is the same.

The problem seems to be that when the cell doesn't have any format string associated, DataFormatter doesn't apply the General formatter.
To test that I added some code at the end of XLSX2CSV.MyXSSFSheetHandler.startElement

public void startElement(String uri, String localName, String name,
                         Attributes attributes) throws SAXException {
   else if ("c".equals(name)) {
      else if (cellStyleStr == null){

With that modification the output is 0.4479
Comment 1 Sebas 2012-09-18 14:56:14 UTC
Created attachment 29382 [details]
Contains the described formula
Comment 2 Javen O'Neal 2016-01-22 05:09:20 UTC
Fixed by bug 57951.

See Bug 58883 comment 6 for an explanation.