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 2011/02/10 19:45:55 UTC

DO NOT REPLY [Bug 50756] New: XLS file with style of GENERAL changes behaviour of DataFormatter

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

           Summary: XLS file with style of GENERAL changes behaviour of
                    DataFormatter
           Product: POI
           Version: 3.7
          Platform: PC
            Status: NEW
          Severity: minor
          Priority: P2
         Component: POI Overall
        AssignedTo: dev@poi.apache.org
        ReportedBy: jfrancis@his.co.uk


Created an attachment (id=26635)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=26635)
File which reproduces the problem

I have a spreadsheet created and edited with a mix or Excel 2007 and OpenOffice
3.2.1 build 9502
When I read numbers with org.apache.poi.ss.usermodel.DataFormatter (from
poi-src-3.7-20101029.zip) which are shown as formatted with Format code General
I get them returned in decimal format, even when they are shown as Integers.
i.e. the old 12 being passed back as 12.0. I tracked the problem down to what
is returned as the cell.getCellStyle().getDataFormatString() in the private
Format getFormat(Cell cell) of the DataFormatter class. This returns "GENERAL"
not "General" for some reason (OpenOffice seems to have changed it) so the part
of the code in private Format getFormat(double cellValue, int formatIndex,
String formatStr)  which handles the General style nicely;

if ("General".equals(formatStr) || "@".equals(formatStr)) {
            if (DataFormatter.isWholeNumber(cellValue)) {
                return generalWholeNumFormat;
            }
            return generalDecimalNumFormat;
        }

is never called. 

N.B. I do not get this problem with files purely edited by Excel or OpenOffice,
it only seems to appear when I mix and match...

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 50756] XLS file with style of GENERAL changes behaviour of DataFormatter

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

JF <jf...@his.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jfrancis@his.co.uk
         OS/Version|                            |All

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 50756] XLS file with style of GENERAL changes behaviour of DataFormatter

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

Nick Burch <ni...@alfresco.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #1 from Nick Burch <ni...@alfresco.com> 2011-02-11 07:32:05 EST ---
Fixed in r1069775.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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