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 2009/05/05 15:07:07 UTC
DO NOT REPLY [Bug 47154] New: HSSFDataFormatter returns wrongly
formatted string, and does not use the default number format set by user for
cell with with invalid cell format
https://issues.apache.org/bugzilla/show_bug.cgi?id=47154
Summary: HSSFDataFormatter returns wrongly formatted string,
and does not use the default number format set by user
for cell with with invalid cell format
Product: POI
Version: 3.2-FINAL
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
AssignedTo: dev@poi.apache.org
ReportedBy: kala@sankya.com
Created an attachment (id=23612)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23612)
Sample spreadsheet with a numeric cell A1 set with format = "@".
Create a numeric cell with a number in it and specify its format as Text ("@").
Excel will still display the number using the "General" format. (Assuming the
number was 2345, Excel displays "2345"). However, if you use the
HSSFDataFormatter.formatCellvalue() method, the string returned is "2345.0"
which means the returned value is formatted using the String.valueOf() function
of Java. (Sample spreadsheet attached)
Calling the HSSFDataFormatter.createFormat(cell) with this cell returns null
since the format string "@" is not a valid numeric formatter. In such a
scenario one would expect HSSFDataFormatter to either use the "General" format
(which is what Excel does) or to at least use the default format if set by the
user using the HSSFDataFormatter.setDefaultNumberFormat() method. It does
neither, and uses String.valueOf instead.
No workaround except to check for this situation externally and avoid using
HSSFDataFormatter's formatCellValue() method in such a situation.
--
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 47154] HSSFDataFormatter returns wrongly formatted
string, and does not use the default number format set by user for cell with
with invalid cell format
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47154
Nick Burch <ni...@torchbox.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #1 from Nick Burch <ni...@torchbox.com> 2009-05-16 10:39:48 PST ---
Thanks for the bug report, now fixed in svn
--
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