OutOfMemory when creating large excel files is a limitation of POI.
The only way to solve the OutOfMemory problem is to provide larger
heap value.
We have plans to improve it. Hope to get it fixed in future versions
of POI.

Yegor

> Hi Yehor,

> I have to build a workbook with one sheet and 16500rows x 30cells, but it's
> don't !

> This is a servlet' Tomcat and around 10000rows the process stop (out of
> memory).

> I'm use :
> Eclipse 3.2
> Tomcat 5.0.18
> Win XP Pro 2002 SP2
> 3 Ghz 1Go

> My JVM configuration :
> -vmargs
> -Xms512m
> -Xmx512m
> -XX:PermSize=512m
> -XX:MaxPermSize=512m



> The code :

> public void addAResulset(ArrayList aResulset, int startLine) {
>     for (int line = 0; line < aResulset.size(); line++) {
>       addRow((ArrayList)aResulset.get(line), startLine + line, null);
>     }
> }

> public void addRow(ArrayList rowData, int numLigne, HSSFCellStyle cellStyle)
> {
>     SimpleDateFormat formatDateFR = new SimpleDateFormat("dd/MM/yyyy");
>     Timestamp typeDate = new Timestamp(0);
>     BigDecimal typeNumber = new BigDecimal(0);

>     HSSFRow row = null;
>     HSSFCell cell = null;

>     row = this._sheet.createRow(numLigne);

>     for (int i = 0; i < rowData.size(); i++) {
>       cell = row.createCell((short) i);

>       if (cellStyle != null) {
>         cell.setCellStyle(cellStyle);
>       }

>       Object object = (Object)rowData.get(i);

>       if (object != null) {
>         if (object.getClass().isInstance(typeDate)) {
>           Date date = (Date)object;
>           cell.setCellValue(new HSSFRichTextString(formatDateFR.format
> (date)));
>         } else if (object.getClass().isInstance(typeNumber)) {
>           Number number = (Number)object;
>           cell.setCellValue(number.doubleValue());
>         } else {
>           cell.setCellValue(new
> HSSFRichTextString(((String)object).trim()));
>         }
>       } else {
>         cell.setCellValue(new HSSFRichTextString(""));
>       }
>     }
>   }


> Any idea or information ?
> Thanks

> Regards

> Chris


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to