Bug 23628

Summary: Excel cannot open HSSF file with 30,000 rows generated by POI
Product: POI Reporter: Robert Lowe <rmlowe>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 2.0-pre3   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Test case (test runs without errors, but Excel 2000 cannot open output document)

Description Robert Lowe 2003-10-06 17:23:35 UTC
Initially, OutOfMemory errors were encountered, however after increasing the JVM
heap size the program that generates the HSSF file appeared to run correctly.
However, Excel 2000 cannot open the output file produced. (There's no error
message--the document window just flashes up on the screen for a split
second before disappearing.)

Below is a simple test case that demonstrates the problem:

================================================================================
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;


public final class HssfTest {
	public static final void main(final String[] args) throws IOException {
		final HSSFWorkbook wb = new HSSFWorkbook();
		final HSSFSheet sheet = wb.createSheet();
		for (int i = 0; i < 30000; i++) {
			final HSSFRow row = sheet.createRow(i);
			final HSSFCell cell = row.createCell((short) 0);
			cell.setCellValue(Integer.toString(i));
		}
		final OutputStream out = new FileOutputStream(new File
("C:\\test.xls"));
		try {
			wb.write(out);
		} finally {
			out.close();
		}
	}
}
Comment 1 Robert Lowe 2003-10-06 17:25:16 UTC
Created attachment 8469 [details]
Test case (test runs without errors, but Excel 2000 cannot open output document)
Comment 2 Jason Height 2003-10-06 22:09:22 UTC

*** This bug has been marked as a duplicate of 15375 ***