В сообщении от 14 Июль 2007 05:49 Igor Androsov написал(a):
> You can use HSSFCel object to get the data type, if
> its string string you done. If its other types numeric
> it may be date number etc you can formatit.
> I used this code to deal with dates numerics: 
Thanx! I have similar code in place, but still have some mysteries:

> {
> case HSSFCell.CELL_TYPE_STRING:
>  cl = cell.getStringCellValue();
> break;                           case
> HSSFCell.CELL_TYPE_NUMERIC:                  icl =
> cell.getNumericCellValue();
>  if (isCellDateFormatted(cell))                      {
I've tried this function, it failed to recongise date formats from my 
ooo-saved excel document with 

So I've falled to home-grown 
 private static boolean isDateFormat(HSSFCell cell, HSSFDataFormat format)
 {
  short fmt = cell.getCellStyle().getDataFormat();
  String df = format.getFormat(fmt);
  if(df.indexOf('D') >= 0
   || df.indexOf('M') >= 0
   || df.indexOf('Y') >= 0
   || df.indexOf('H') >= 0
   || df.indexOf('S') >= 0)
   return true;
  return false;
 }

It kinda works, but I guess I might have missed something.

>                               // format in form of
> M/D/YY
>                                     Calendar cal =
> Calendar.getInstance();
>
> cal.setTime(getJavaDate(icl,false));
>                                     String pattern =
> getCellDateFormat(cell);
I can't find this function in library, and syntax suggests it's your locally 
defined method.

Can you please send its contents to me or to this list, I guess it's really 
what I'm looking for.

Anyway, thanx for support!

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

Reply via email to