poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davinder Kohli <kdavin...@yahoo.com>
Subject How to distinguish between different dates formats and decimals
Date Sun, 11 Apr 2004 00:40:39 GMT
I am trying to get the actual format of the cell
containing different date formats and decimal values.
I am also trying to determine how many decimal places
are there in a decimal field.

Since the celltype returned for all of them is
NUMERIC, I get the cell style and then check the
dataformat as shown below. 

int cellType = theCell.getCellType();
HSSFCellStyle cellStyle = theCell.getCellStyle();
short dataFormatIndex = cellStyle.getDataFormat(); 

For all the 17 date formats supported by excel the
dataformatIndex was one the following indexes:

I got the same indexes back for some of the decimal
values. The dataFormatIndex is unique when the dates
and decimals are in the same sheet but when they are
in separate sheets, the dataFormatIndex is same for,
say, date in the format 3/12/2001 and a decimal field
having 3 decimal places.

Please let me know if you need me to be more specific.
BTW I have tried the HSSFDateUtil methods, they return
me true for fields containing decimal values.

Any help would be appreciated!

Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th

To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org

View raw message