Hi Mike.

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.

Regards,        Karl-Heinz.


-----Urspr�ngliche Nachricht-----
Von: Mike Wertheim [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 22. Dezember 2004 21:33
An: [email protected]
Betreff: When is an HSSFCell a date?


Hi all,

I'm new to the list.  I've been a poi user for a year and have been
loving it.

I need to parse some date fields from an xls file, and am a bit
confused.  It seems that if a cell contains a date,
HSSFCell.getCellType() returns CELL_TYPE_NUMERIC.  If I know in advance
that the cell contains a date, I can easily convert the returned number
into a date.  But if I don't know in advance what is in the cell, how
can I determine if the cell is a date or not?

Is this something that the file format make particularly difficult, or
is it a poi implementation issue?


Thanks!

-Mike Wertheim
www.linkify.com




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to