[prev in list] [next in list] [prev in thread] [next in thread] 

List:       poi-user
Subject:    HSSFDateUtil & Event API
From:       "Justo Casablanca" <jcasablanca () cfl ! rr ! com>
Date:       2002-09-27 20:06:13
[Download RAW message or body]

I was wondering how to use HSSFDateUtil to parse a numeric field into a
Date when using the event API to read XLS files.  You see, the method
HSSFDateUtil.isCellDateFormatted(...) takes an HSSFCell as argument,
not a NumberRecord. So, how can I get an HSSFCell from a NumberRecord ?
I thought about using the following code:

1) POIFSFileSystem fs      =
            new POIFSFileSystem(new FileInputStream("workbook.xls"));
2) HSSFWorkbook wb = new HSSFWorkbook(fs);
3) HSSFSheet sheet = wb.getSheetAt(0);
4) HSSFRow row = sheet.getRow(2);
5) HSSFCell cell = row.getCell((short)3);
6) Now I can use HSSFDateUtil.isCellDateFormatted(...) to test the HSSFCell
!!

But, isn't this the "user API" approach ? Doesn't step 2) automatically load
the
entire file structure into memory, which is what I'm trying to avoid by
using the
event API ?

Thx in advance for your help !!


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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic