Okay, just commited some changes to CVS to add convience methods to
HSSFCell.
Here's and extract of a test case that creates and styles a date cell.
File file =
File.createTempFile("testWriteSheetStyleDate",
".xls");
FileOutputStream out = new FileOutputStream(file);
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet s = wb.createSheet();
HSSFCellStyle cs = wb.createCellStyle();
HSSFRow row = s.createRow((short)0);
HSSFCell cell = row.createCell((short)1);
cs.setDataFormat(HSSFDataFormat.getFormat("m/d/yy"));
cell.setCellStyle(cs);
cell.setCellValue(new Date());
wb.write(out);
out.close();
Easy. I'm going to have to bite the bullet and write some doco now. First
I've got to change my daughters nappy.. *phewy!*
Regards,
Glen Stampoultzis
[EMAIL PROTECTED]
+61 3 9753-6850 - 0402 835 458 (mob)
ICQ: 62722370 AIM: FubbleWobble
----- Original Message -----
From: "Thutika, Swamy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 12, 2002 12:06 AM
Subject: RE: Can't read date cells
> Glen,
> Where is the info on this in absence of the api documentation? Atleast
> the source code so that i can find the calls to use this.
>
> thanks in advance,
> Swamy
>
> -----Original Message-----
> From: Glen Stampoultzis [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, February 09, 2002 5:43 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Can't read date cells
>
>
>
> Dates are basically just numerics so this is right. As mentioned in the
> other mail use HSSFDateUtil. I should look into providing something more
> obvious. Adding it to the documentation is on my todo list also.
>
> Regards,
>
> Glen
>
>
> ----- Original Message -----
> From: "Andrew C. Oliver" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, February 09, 2002 11:42 PM
> Subject: Re: Can't read date cells
>
>
> > I don't believe this has been implemented yet.. . Glen?
> >
> >
> > On Fri, 2002-02-08 at 13:48, Thutika, Swamy wrote:
> > > I am not able to read the cells with the date format. Is this not
> > > implemented or is there a different way
> > > of reading the date cells.
> > >
> > > I get the cell type as numeric for date cells.
> > >
> > > --Swamy
> > --
> > www.superlinksoftware.com
> > www.sourceforge.net/projects/poi - port of Excel format to java
> > http://developer.java.sun.com/developer/bugParade/bugs/4487555.html
> > - fix java generics!
> >
> >
> > The avalanche has already started. It is too late for the pebbles to
> > vote.
> > -Ambassador Kosh
> >