poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean, Victor [IT]" <victor.j...@citigroup.com>
Subject HELP!! Bug with Output File Size!!!
Date Fri, 21 May 2004 01:15:18 GMT
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


Mime
View raw message