You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "KHZ (SAW)" <ka...@sawag.com> on 2004/09/01 10:43:19 UTC
AW: Problem writing an Excel file several times.
Hi Dan.
Does it also appear if e.g. you append a sequence number to the file and
thus always have a new file?
I think such a comparison should be easy to test.
Regards, Karl-Heinz.
-----Ursprüngliche Nachricht-----
Von: Daniel de Miguel González [mailto:dmg62@tid.es]
Gesendet: Dienstag, 31. August 2004 12:52
An: poi-user@jakarta.apache.org
Betreff: Problem writing an Excel file several times.
Hi everybody,
My name is Daniel de Miguel, and I'm new in this mailing list. Please
apologize my poor english.
I've got a problem generating a large excel file. The logical secuence
is as it follows:
I create the HSSFWorkbook, y generate the data,
When I reach a condition (for example, the number of rows generated is
1000) I call the write method of the workbook.
I close the workbook.
I re-open it (I do this to avoid an OutOfMemory Exception, and it works
:-D )
I continue generating...
The problem i have is that I only retrieve the information generated on
the first loop.
BUT (!!!!) as i' m writing the file increases his size when i call the
write method! I dont understand why the data does not apear.
Here is the code
FileOutputStream out = null;
FileInputStream in =null;
HSSFWorkbook wb = null;
HSSFSheet sheet = null;
HSSFRow row = null;
HSSFCell c = null;
while ( THERE IS MORE DATA TO GENERATE){
if (CONDITION (i.e. ROWS%1000==0)){
wb.write(out);
wb=null;
sheet=null;
row=null;
c=null;
in = new
FileInputStream(pathExcel+"informeMedida"+codOpCompleja+".xls");
wb = new HSSFWorkbook(in);
sheet = wb.getSheet( "sheetname");
}
row = sheetPlaca.createRow(ROWS);
ROWS++;
c=row.createCell(0);
c.setCellValue(DATA);
/*..... Writing the data ....*/
}//while
Thank you very much.
Daniel.
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org