You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2012/09/12 14:10:37 UTC

[Bug 53859] New: DataFormatter Numeric cell value extra digits

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

          Priority: P2
            Bug ID: 53859
          Assignee: dev@poi.apache.org
           Summary: DataFormatter Numeric cell value extra digits
          Severity: normal
    Classification: Unclassified
                OS: Windows Vista
          Reporter: scgdevelop@gmail.com
          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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 53859] DataFormatter Numeric cell value extra digits

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53859

--- Comment #1 from Sebas <sc...@gmail.com> ---
Created attachment 29382
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29382&action=edit
Contains the described formula

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org