poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prashant Dube <p...@rocketmail.com>
Subject Re: Creating Excel File
Date Tue, 29 Jun 2004 19:53:20 GMT
POI Community;
 
I was able to resolve the problem. It turned out to be a bug in my code. There was a "stray"
line of code that was causing the problem. So instead of having 
1)  cell = row.createCell(cellNbr);
 
I had 
 
2)
cell = row.createCell(rowNbr); // this line is not necessary

cell = row.createCell(cellNbr);
 
The cell = row.createCell(rowNbr) statement was trying to create cells beyond cell # 255 (remember
excel can only handle 255 cells in a row) - rowNbr looped from 0 to the maximum number to
rows to be written in a sheet.
 
The struts application is using POI version 1.5, which does not throw any exception when creating
more than 255 cells in an excel. I was able to identify the issue using POI version 2.5, which
throws an exeption for the same case.
 
Thank you for your help and support.
My faith in POI is restored! :-)
 
 
 
 

Danny Mui <danny@muibros.com> wrote:
help us debug the rogue sheet.

1) does this occur with that one sheet alone?

basically if u can reproduce this in as little code/data as possible it 
is a likely case that somebody can help you out.

of course we need examples etc and the best place to put this is into a 
bug to stamp out.

Prashant Dube wrote:

> I realize that excel has a 65k limit. I have a struts based app that is writing to a
2 sheet excel file from 2 DB tables - each table goes to its own sheet. The first sheet has
order items while the second has products. The products are usually < 50 but the order
items for an order can be 1000+
> 
> I have tested orders for 10, 100, 200 and 300. the excel file is created successfuly
in all cases. however, excels created for the order with 300 items does not open. excel fails
on win2k with a "memory not available" error even tho the file is just 85k. i dont believe
this is a data error. in my tests, i was able to open an exel cantaining the first 260 items
of the same order and also the last 260 of the same order i.e. i can only 260 lines of an
order in an excel file. the POI code runs successfully with no errors or exceptions. have
no clue as to whats happening!
> 
> in a separate test (simple java code using main method) i attempted to write an excel
file having 2 sheets . i wrote out 10k rows having 50 cols in both the 2 sheets without any
error. i used 512m for the JVM memory size. the same test gave an OUT OF MEMORY error for
the JVM when trying to create a workbook with 50k rows of 50 cols in the same 2 sheets. the
file opens without an errors thru excel.
> 
> i understand the JVM limitation, but what i cant fathom is why the file created from
the struts app fails to open even tho it isnt failing with a JVM error
> 
> 
> 

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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message