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 2008/05/14 13:29:34 UTC

DO NOT REPLY [Bug 44996] New: Text cells are treated as numeric if they happen to contain only 0-9

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

           Summary: Text cells are treated as numeric if they happen to
                    contain only 0-9
           Product: POI
           Version: 3.0
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: mbp@back-bone.dk


I'm not sure if my problem is identical to 39998, but here goes:

In the description of the class HSSFCell is says ” String cells cannot
conatin numbers and numeric cells cannot contain strings (at least according to
our model).”
This model causes some problems that are hard to work around when dealing with
users input:

1. A string cell, that is a cell for which the format in Excel has explicitly
been specified as “Text”, should be allowed to contain anything. But if the
cell happens to contain only characters in the range ‘0’-‘9’
getCellType() returns NUMERIC and getRichStringCellValue() throws an exception.

2. A date cell, again explicitly formatted as such in Excel, is also treated as
numeric cell when it contains a date like “01.07.2008”


If possible I would like HSSFCell to either quit the guessing and the assuming,
or implement something like getRawCellType() and getRawStringCellValue() that
would return the data the user entered and not a processed result.


-- 
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 44996] Text cells are treated as numeric if they happen to contain only 0-9

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


David Fisher <df...@jmlafferty.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |INVALID




--- Comment #4 from David Fisher <df...@jmlafferty.com>  2009-02-18 12:29:08 PST ---
Without a response to Nick's test this will be marked INVALID.


-- 
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 44996] Text cells are treated as numeric if they happen to contain only 0-9

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


Martin Schöffler <ma...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |martin.schoeffler+asfbugzill
                   |                            |a@gmail.com




--- Comment #1 from Martin Schöffler <ma...@gmail.com>  2008-05-14 06:14:58 PST ---
(In reply to comment #0)
> If possible I would like HSSFCell to either quit the guessing and the assuming,
> or implement something like getRawCellType() and getRawStringCellValue() that
> would return the data the user entered and not a processed result.

As I understand it POI is already doing what you propose, as it does no
guessing but only reads what excel wrote to the xls file.
Formatting a cell as text does not mean it is stored as text internally in the
xls-file. Excel automatically stores text that contains only digits as a
NUMERIC.
I had some success in forcing excel to store the value as a string by changing
the value again after I set format to text. The workflow is as follows: entring
value, changing format, changing value. 

But that is not a good workaround. It is best to retrieve the format as pointed
out in bug 39998 and try to format the value accordingly.


-- 
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 44996] Text cells are treated as numeric if they happen to contain only 0-9

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




--- Comment #3 from Nick Burch <ni...@torchbox.com>  2008-05-20 09:52:21 PST ---
Could you please upload a little unit test showing the problem you're having?

I've just had a try (see commit r658336), and everything behaves as I'd expect
it to


-- 
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 44996] Text cells are treated as numeric if they happen to contain only 0-9

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





--- Comment #2 from Michael Bjerregaard-Pedersen <mb...@back-bone.dk>  2008-05-15 05:46:35 PST ---
I don't know the internals of xls-file, but I do not doubt they are tricky.

The reason I submitted this report is that the behaviour has changed from
earlier POI version, leading me to think it was a bug.

I have made it work by making my program know what to expect in from each
column thus making it easier to handle exceptions correct.


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