poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "KHZ (SAW)" <karl-heinz.zenge...@sawag.com>
Subject AW: Date cells
Date Wed, 25 May 2005 16:29:03 GMT
Hi Amol.

Dates come as numeric data. You've methods like getDateCellValue()
(class HSSFCell) and HSSFDateUtil.isCellDateFormatted() and
HSSFDateUtil.isValidExcelDate() to read it as a date or to check whether
it's date formatted.

In case of formula you just have a cell type formula. In that case you
either know the type of its content or you've to guess its type and take
the most reasonable value (the one different from being empty). Guessing
the wrong type doesn't result in an exception. It returns an empty value
of the result type then.

About empty cells read the thread "reading empty cells" in the archive
(in November 2003).

Regards,	Karl-Heinz.


-----Urspr√ľngliche Nachricht-----
Von: Amol Deshmukh [mailto:adeshmukh@hobsons-us.com] 
Gesendet: Mittwoch, 25. Mai 2005 18:17
An: 'POI Users List'
Betreff: RE: Date cells

Marc,

Normally if the cell were not containing any data,
I would expect it to be null or of type "blank".

So could you post the relevant code snippet?

Also, maybe you should run the code against
another xls file that has an empty column with date 
format (I did that and the cell was returned as null)


~ amol




> -----Original Message-----
> From: Luce, Marc [mailto:Marc.Luce@bankofamerica.com]
> Sent: Wednesday, May 25, 2005 10:06 AM
> To: poi-user@jakarta.apache.org
> Subject: Date cells
> 
> 
> I am trying to read an excel file and I am struggling with 
> Date fields.  I have a column that has a custom date format 
> applied to the whole column and there is no data in it.  When 
> I attempt to read this column (cell.getDateCellValue()) I 
> would expect it to return null.  But it is returning today's 
> date.  By the way, getCellType returns 'Numeric'.  Is there 
> anyway for me to detect that that cell is empty?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
> 

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




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


Mime
View raw message