You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Xuemin Guan <xu...@appresso.com> on 2003/08/08 08:35:29 UTC
create cells on an empty sheet
Dear all
I am trying to create cells on a sheet, and is experiencing a bizarre:
1. If I create a xls file from the scratch, I have no problems creating
any cells;
2. If a sheet already has some non-null cells, I have no problems
creating any new cells (like inserting cells to a sheet);
3. If I create cells on a existing sheet, and this sheet contains no
non-null cells(a totally empty sheet), then I can not create any cells.
I got no exception, and the creation process runs happily to the end.
But when I open the xls file, I see not cells created on the sheet.
Does anyone has an idea about this? Any help will be highly appreciated.
Best regards,
Xuemin Guan
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: create cells on an empty sheet
Posted by Xuemin Guan <xu...@appresso.com>.
> The first message was posted on June, 18 , subject : Possible bug writing to "new" sheets
> You can find the list's archive here :
> http://www.mail-archive.com/poi-user%40jakarta.apache.org/
>
Hello Thomas, thanks for your email. It did seem someone else
had experienced the same problem. But no solution mentioned in
the old email threads.
I checked out the latest souce code today, and found
HSSFSheet.getRow(int index)
and HSSFRow.getCell(int index) has broken the method contract.
The JAVA Doc for these 2 methods say if the specified and cell
are not defined in the sheet, you would get a null value. But
not getRow throws NullPointException, and throws
IndexOutOfBoundsException. I can work around the first problem
by first determing the numuber of Rows in a Sheet before I attempt
to retrieve one; But the second one is tricky. If you ask an emtpy
HSSFRow what the last cell number is, you would get 0. But when
you retrieve the No. 0 cell like: HSSFRow.getCell(0), you would get
IndexOutOfBoundsException.
These 2 problems, I guess will break many client code which relies on
the contract.
Any one has a clue?
Thanks a lot,
Xuemin
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: create cells on an empty sheet
Posted by Thomas Luyt <tl...@aedian.com>.
Hi
Clifton Craig, who is a member of the list, came with the same problem about two months ago.
The first message was posted on June, 18 , subject : Possible bug writing to "new" sheets
You can find the list's archive here :
http://www.mail-archive.com/poi-user%40jakarta.apache.org/
More precisely, you'll find the original message here :
http://www.mail-archive.com/poi-user%40jakarta.apache.org/msg02309.html
Hope this will help
Thomas
----- Original Message -----
From: "Xuemin Guan" <xu...@appresso.com>
To: "POI Users List" <po...@jakarta.apache.org>
Sent: Friday, August 08, 2003 10:22 AM
Subject: Re: create cells on an empty sheet
>
> > as far as I know on an empty sheet nothing exists.
> > So before you can create a cell you have to create the accordings rows.
> > Does that maybe help?
> >
>
> Hello Meike, I did create the accroding rows. That is why
> I can insert cells into a sheet which already had some cells.
>
> I just checked out the latest source code and
> built the jars. It now runs into a different problem:
> NullPointException when I use getRow(int index)(the sheet
> is empty). I am looking into this problem now. Will
> get back to you when I find the solution.
>
> Cheers,
>
> Xuemin
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List: http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: create cells on an empty sheet
Posted by Xuemin Guan <xu...@appresso.com>.
> as far as I know on an empty sheet nothing exists.
> So before you can create a cell you have to create the accordings rows.
> Does that maybe help?
>
Hello Meike, I did create the accroding rows. That is why
I can insert cells into a sheet which already had some cells.
I just checked out the latest source code and
built the jars. It now runs into a different problem:
NullPointException when I use getRow(int index)(the sheet
is empty). I am looking into this problem now. Will
get back to you when I find the solution.
Cheers,
Xuemin
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: create cells on an empty sheet
Posted by Meike Reichle <mr...@rz.uni-hildesheim.de>.
Hi,
as far as I know on an empty sheet nothing exists.
So before you can create a cell you have to create the accordings rows.
Does that maybe help?
Best
Meike
----- Original Message -----
From: "Xuemin Guan" <xu...@appresso.com>
To: "POI Users List" <po...@jakarta.apache.org>
Sent: Friday, August 08, 2003 8:35 AM
Subject: create cells on an empty sheet
> Dear all
>
> I am trying to create cells on a sheet, and is experiencing a bizarre:
>
> 1. If I create a xls file from the scratch, I have no problems creating
> any cells;
>
> 2. If a sheet already has some non-null cells, I have no problems
> creating any new cells (like inserting cells to a sheet);
>
> 3. If I create cells on a existing sheet, and this sheet contains no
> non-null cells(a totally empty sheet), then I can not create any cells.
> I got no exception, and the creation process runs happily to the end.
> But when I open the xls file, I see not cells created on the sheet.
>
> Does anyone has an idea about this? Any help will be highly appreciated.
>
> Best regards,
>
> Xuemin Guan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List: http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
>
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/