You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by Steve <st...@Basit.COM> on 2003/07/02 01:40:04 UTC

re: CANNOT WRITE TO BLANK SHEET 0 after reading template

ACO,
Thanks for your reply. I guess I got more motivation to find the problem,
and
I believe that this is it:  There is a bug.
This type of problem was discussed by Cliff (Clifton Craig) and you can see
about 12 of his posts to the list around June 18.
The subject line is:  "Cannot write to extra sheets"
One of his emails is below.
I solved my problem by simply writing data in one cell on the template
sheet.
I guess I will have my POI program later erase that value before writing the
new xls file.
My prior application didn't run into this problem because I put "tags" in
sheet 0, and then erased them.
In my current application, I started out with one tag in the template.xls,
and things were going
fine. I didn't make the connection of erasing that tag with the onset of my
problem.
Note that the problem persists if I create a new template and delete all
the original sheets, add 6 new sheets, and save the template.xls so that
I can read it in POI.
I have not yet tried writing to sheet 1 or 2 or 3 etc. Only to sheet at
index 0.

THANKS,
Steve
--------------------------------

Hello all,

I am having a problem writing to the extra sheets that Excel creates by
default when you create a new workbook. I'm using the
jakarta-poi1.8.0-dev-20020919.jar version. I've developed a conversion
program that allows data to be merged with existing spreadsheets. The merge
works when I attempt to write on a sheet that has already been written on.
However, whenever I attempt to write to one of the blank sheets (sheets 2
and 3) that Excel creates automatically with an empty workbook it doesn't
work. I can adjust the width of cells in these sheets but they do not
retain any info from the  cell.setCellValue() method calls. I verified in
debug that these methods are not failing. My debugger (Eclipse) allows me
to see the cell values before and after the method calls. I've attempted
many tests where I enter the exact same parameters to merge data to an
existing workbook changing only the sheet number. The data is retained only
on the 1st sheet where I've already added data. This is the only variance
in my test runs. In all cases I obtain references to the sheet, row and
cell objects the same way. I do a Workbook.getSheetAt(int num) to get the
existing sheet. (I've tried with Workbook.getSheet(String name) as well.) I
am using Worksheet.createRow(short row) to create the row and
Row.createCell(short cell) to create cell references. In my code I verify
that the rows and cells do not exist prior to creating. In the latter case
I use the corresponding methods to obtain references to the existing
objects. What am I missing?

-Cliff



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

----- Original Message -----
From: "Andrew C. Oliver" <ac...@apache.org>
To: "POI Developers List" <po...@jakarta.apache.org>
Sent: Tuesday, July 01, 2003 5:56 PM
Subject: Re: any ideas on what could be causing this....NEED HELP


> Gosh, that could be anything.  Perhaps if you reduced to the minimum
amount
> of code that reproduces the problem (with a static void main), attached
the
> XLS to a bug in bugzilla we could help.
>
> 9/10 the person reporting this finds they have an obvious coding error
> before they ever get that far ;-)
>
> 1/10 times the help us find a serious issue and we are very grateful
>
>
> On 7/1/03 5:51 PM, "Steve" <st...@Basit.COM> wrote:
>
> > (see below)
> > Also, if I add certain statements back into the program
> > (these statements are not the problem) then Excel crashed
> > after a few seconds after it opens the created file. The
> > message box says:
> > The instruction at "0x301bf877" referenced memory at
> > "0x00000000". The memory could not be "read".
> >
> > I'm using:  jakarta-poi-1.10.0-dev-20030222.jar
> > THANKS,
> > Steve
> > ----- Original Message -----
> > From: "Steve" <st...@Basit.COM>
> > To: "POI Developers List" <po...@jakarta.apache.org>
> > Sent: Tuesday, July 01, 2003 5:05 PM
> > Subject: HELP: any ideas on what could be causing this....
> >
> >
> >> I read in a template xls file and use POI to change it.
> >> It was working fine for a while, but now
> >> when I open the created  xls file,  there are
> >> no data written to it.
> >> Some formatting changes are visible,
> >> such as merged cell regions, but that's
> >> all.
> >> It seems like my program is going through
> >> it's paces, and there are no exceptions,
> >> but the sheet is blank.
> >> Any ideas what could cause this.
> >> I'm using 1.10
> >> THANKS,
> >> Steve
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: poi-dev-help@jakarta.apache.org
> >
>
> --
> Andrew C. Oliver
> http://www.superlinksoftware.com/poi.jsp
> Custom enhancements and Commercial Implementation for Jakarta POI
>
> http://jakarta.apache.org/poi
> For Java and Excel, Got POI?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
>


Re: CANNOT WRITE TO BLANK SHEET 0 after reading template

Posted by "Andrew C. Oliver" <ac...@apache.org>.
Was there a basic executable code + xls that reproduces it?

On 7/1/03 7:40 PM, "Steve" <st...@Basit.COM> wrote:

> ACO,
> Thanks for your reply. I guess I got more motivation to find the problem,
> and
> I believe that this is it:  There is a bug.
> This type of problem was discussed by Cliff (Clifton Craig) and you can see
> about 12 of his posts to the list around June 18.
> The subject line is:  "Cannot write to extra sheets"
> One of his emails is below.
> I solved my problem by simply writing data in one cell on the template
> sheet.
> I guess I will have my POI program later erase that value before writing the
> new xls file.
> My prior application didn't run into this problem because I put "tags" in
> sheet 0, and then erased them.
> In my current application, I started out with one tag in the template.xls,
> and things were going
> fine. I didn't make the connection of erasing that tag with the onset of my
> problem.
> Note that the problem persists if I create a new template and delete all
> the original sheets, add 6 new sheets, and save the template.xls so that
> I can read it in POI.
> I have not yet tried writing to sheet 1 or 2 or 3 etc. Only to sheet at
> index 0.
> 
> THANKS,
> Steve
> --------------------------------
> 
> Hello all,
> 
> I am having a problem writing to the extra sheets that Excel creates by
> default when you create a new workbook. I'm using the
> jakarta-poi1.8.0-dev-20020919.jar version. I've developed a conversion
> program that allows data to be merged with existing spreadsheets. The merge
> works when I attempt to write on a sheet that has already been written on.
> However, whenever I attempt to write to one of the blank sheets (sheets 2
> and 3) that Excel creates automatically with an empty workbook it doesn't
> work. I can adjust the width of cells in these sheets but they do not
> retain any info from the  cell.setCellValue() method calls. I verified in
> debug that these methods are not failing. My debugger (Eclipse) allows me
> to see the cell values before and after the method calls. I've attempted
> many tests where I enter the exact same parameters to merge data to an
> existing workbook changing only the sheet number. The data is retained only
> on the 1st sheet where I've already added data. This is the only variance
> in my test runs. In all cases I obtain references to the sheet, row and
> cell objects the same way. I do a Workbook.getSheetAt(int num) to get the
> existing sheet. (I've tried with Workbook.getSheet(String name) as well.) I
> am using Worksheet.createRow(short row) to create the row and
> Row.createCell(short cell) to create cell references. In my code I verify
> that the rows and cells do not exist prior to creating. In the latter case
> I use the corresponding methods to obtain references to the existing
> objects. What am I missing?
> 
> -Cliff
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
> 
> ----- Original Message -----
> From: "Andrew C. Oliver" <ac...@apache.org>
> To: "POI Developers List" <po...@jakarta.apache.org>
> Sent: Tuesday, July 01, 2003 5:56 PM
> Subject: Re: any ideas on what could be causing this....NEED HELP
> 
> 
>> Gosh, that could be anything.  Perhaps if you reduced to the minimum
> amount
>> of code that reproduces the problem (with a static void main), attached
> the
>> XLS to a bug in bugzilla we could help.
>> 
>> 9/10 the person reporting this finds they have an obvious coding error
>> before they ever get that far ;-)
>> 
>> 1/10 times the help us find a serious issue and we are very grateful
>> 
>> 
>> On 7/1/03 5:51 PM, "Steve" <st...@Basit.COM> wrote:
>> 
>>> (see below)
>>> Also, if I add certain statements back into the program
>>> (these statements are not the problem) then Excel crashed
>>> after a few seconds after it opens the created file. The
>>> message box says:
>>> The instruction at "0x301bf877" referenced memory at
>>> "0x00000000". The memory could not be "read".
>>> 
>>> I'm using:  jakarta-poi-1.10.0-dev-20030222.jar
>>> THANKS,
>>> Steve
>>> ----- Original Message -----
>>> From: "Steve" <st...@Basit.COM>
>>> To: "POI Developers List" <po...@jakarta.apache.org>
>>> Sent: Tuesday, July 01, 2003 5:05 PM
>>> Subject: HELP: any ideas on what could be causing this....
>>> 
>>> 
>>>> I read in a template xls file and use POI to change it.
>>>> It was working fine for a while, but now
>>>> when I open the created  xls file,  there are
>>>> no data written to it.
>>>> Some formatting changes are visible,
>>>> such as merged cell regions, but that's
>>>> all.
>>>> It seems like my program is going through
>>>> it's paces, and there are no exceptions,
>>>> but the sheet is blank.
>>>> Any ideas what could cause this.
>>>> I'm using 1.10
>>>> THANKS,
>>>> Steve
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
>>> 
>> 
>> --
>> Andrew C. Oliver
>> http://www.superlinksoftware.com/poi.jsp
>> Custom enhancements and Commercial Implementation for Jakarta POI
>> 
>> http://jakarta.apache.org/poi
>> For Java and Excel, Got POI?
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
>> 
> 

-- 
Andrew C. Oliver
http://www.superlinksoftware.com/poi.jsp
Custom enhancements and Commercial Implementation for Jakarta POI

http://jakarta.apache.org/poi
For Java and Excel, Got POI?