You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Yegor Kozlov <ye...@dinom.ru> on 2007/10/18 13:39:44 UTC
Re[4]: Export an image as PNG to a particular cell in Excel using POI.
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: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Re[4]: Export an image as PNG to a particular cell in Excel using POI.
Posted by Christophe Charles <ch...@gmail.com>.
Thank Yegor !
I've change my eclipse.ini file like :
-vmargs
-Xms512m
-Xmx768m
And I put this values in the Eclipse'menu :
Window/Preferences/Tomcat/Parameters JVM/
Now it seems work fine !
Regards
Chris
2007/10/18, Yegor Kozlov <ye...@dinom.ru>:
>
> 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: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>