You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Karl-Heinz Zengerle <ka...@sawag.com> on 2004/06/01 14:51:04 UTC

AW: HELP!! Bug with Output File Size!!!

Hi Jean.

Excel itself seems to allocate chunks of data (16 row portions or
something like that). I was asking "Phantom cells" or something like
that possibly 2 months ago and there the topic was discussed a lot.

So the revised question would be whether also with deleting a lot of
rows the allocated memory would still be used and just the content of
the cells would be reset.

In Excel itself we've reduced the size successfully. For postprocessing
files in Excel we've used a marker indicating that at the next startup
Excel has to do something (just once).

Regards,	Karl-Heinz.


-----Ursprüngliche Nachricht-----
Von: Jean, Victor [IT] [mailto:victor.jean@citigroup.com] 
Gesendet: Freitag, 21. Mai 2004 03:15
An: POI Users List
Betreff: HELP!! Bug with Output File Size!!! 

I'm running into a bug with the file size of the outputfile.
I have a template excel file that's about 1 megabyte in size of just
plain unformatted data on sheet one.
I'm reading this file in and then removing all the rows from sheet one
and writing to a output file.
The output file size is listed as 500K, but it has NO data at all.  It
is completely empty.
When I go ahead and click the "Save" button in excel and close the
spreadsheet, the size shrinks to 14K.

Is this a bug or am i doing something wrong?  
Why is the output file size so big even though there's no data at all ?


___________________My Code Start____________________

POIFSFileSystem fs = new POIFSFileSystem(new
FileInputStream("c:/bigfile.xls"));
HSSFWorkbook hssfworkbook = new HSSFWorkbook(fs);
HSSFSheet        sheet  = hssfworkbook.getSheetAt(0);
						
			
// Create outputstream for excel file
FileOutputStream stream = new FileOutputStream("c:/smallfile.xls");

int numberRows = sheet.getLastRowNum()+1;
for (int k = 0; k < numberRows; k++)
{
	HSSFRow row = sheet.getRow(k);
      if (row != null) {
      	sheet.removeRow(row);
    	}
}

hssfworkbook.write(stream);
stream.close();

___________________My Code End______________________

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


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