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 2006/12/12 18:09:48 UTC

DO NOT REPLY [Bug 41161] New: - getDateCellValue() doesn't deal with formula cells returning a date.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41161>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41161

           Summary: getDateCellValue() doesn't deal with formula cells
                    returning a date.
           Product: POI
           Version: unspecified
          Platform: All
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: adam.buchbinder@gmail.com


It's possible to use formulas to deal with dates; for instance, the first cell
in a column of dates will be set, and the rest of them will be set by reference,
so that only one cell needs to be modified.

However, getDateCellValue() doesn't test for formula cells, so that when one
tries to pull a date from a cell set in this manner, it will default to an
attempt to get the cell's numeric value and use that, which will not give the
correct results.

The relevant class is org.apache.poi.hssf.usermodel.HSSFCell, and this issue is
present in SVN revision 486227.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


DO NOT REPLY [Bug 41161] - getDateCellValue() doesn't deal with formula cells returning a date.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41161>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41161





------- Additional Comments From amolweb@yahoo.com  2006-12-12 12:40 -------
If you have last saved the file using an external application the following
should give you the expected date value:

HSSFDateUtil.getJavaDate(value);

However, if the cell value was last edited using POI, you will not get the
correct "date" value. This is because until the file is opened by an external
application the formula will not be evaluated and hence the "stored" value will
not reflect the expected value. You could try to use the HSSFFormulaEvaluator to
evaluate the formula cell and then use HSSFDateUtil.getJavaDate to convert the
value to a Java Date.

If this does not resolve your problem,  please post some code that illustrates
the problem.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/