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
Hi,
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:
14,15,16,17,18,19,20,21,22,164,165,168,169,170,171,172,173,174,175,177,176,178,179,180,181,182.

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
http://taxes.yahoo.com/filing.html

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


Mime
View raw message