|
I got a java.lang.OutOfMemoryError exception when I am writing to an
Excel file. I use poi 2.5.1. This happens after writing 7,800 lines. Checking to the computer memory, it seems however that I still have plenty of memory. Also, writing smaller files works fine. Here is the code (which I think is no surprise): HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet(sheetTitle); HSSFRow row; HSSFCell cell; for (int rownum = 0; rownum <= jdbTable.getRowCount(); rownum++) { row = sheet.createRow((short)(rownum+2)); for (int cellnum = 0; cellnum < jdbTable.getColumnCount();cellnum++) { cell = row.createCell((short)cellnum); Object value = jdbTable.getValueAt(rownum - 1, cellnum); if (jdbTable.getColumnClass(cellnum).getName().equals("java.lang.Integer")) cell.setCellValue(((Integer)value).intValue()); else if (jdbTable.getColumnClass(cellnum).getName().equals("java.lang.Double")) cell.setCellValue(((Double)value).doubleValue()); else if (jdbTable.getColumnClass(cellnum).getName().equals("java.lang.String")) cell.setCellValue((String)value); } } wb.write(fos); fos.close(); Thank you for any advice. --
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Jordi Moltó ABM Informática, S.L. [EMAIL PROTECTED] Este mensaje y sus anexos pueden contener información confidencial y/o con derecho legal. Está dirigido únicamente a la persona/s o entidad/es reseñadas como único destinatario autorizado. Si este mensaje le hubiera llegado por error, por favor elimínelo sin revisarlo ni reenviarlo y notifíquelo inmediatamente al remitente. Gracias por su colaboración. |
Title: firma
- Out of memory with POI-HSSF, when writing Excel file Jordi Moltó
- Re: Out of memory with POI-HSSF, when writing E... Nick Burch
- AW: Out of memory with POI-HSSF, when writing E... Alexander Medina (AM)
