https://issues.apache.org/bugzilla/show_bug.cgi?id=53859

          Priority: P2
            Bug ID: 53859
          Assignee: [email protected]
           Summary: DataFormatter Numeric cell value extra digits
          Severity: normal
    Classification: Unclassified
                OS: Windows Vista
          Reporter: [email protected]
          Hardware: PC
            Status: NEW
           Version: 3.8
         Component: XSSF
           Product: POI

Type 1612.44/3600 in a cell, Excel displays 0.4479, the stored value is 

<f>1612.44/3600</f>
<v>0.44790000000000002</v>

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

[code]
public void startElement(String uri, String localName, String name,
                         Attributes attributes) throws SAXException {
   ...
   else if ("c".equals(name)) {
   ...
      else if (cellStyleStr == null){
         this.formatString="General";
      }
   } 
}
[/code]

With that modification the output is 0.4479

-- 
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