Bug 24355 - Cannot create sheet with over 8215 datapoints
Summary: Cannot create sheet with over 8215 datapoints
Status: RESOLVED DUPLICATE of bug 15375
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-pre3
Hardware: All All
: P3 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-03 14:16 UTC by Dan Shinton
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Shinton 2003-11-03 14:16:25 UTC
This bug is present on both Win32 and Solaris Sparc.

When trying to create a spreadsheet with over 8215 datapoints, the resultant 
xls file becomes corrupt. Excel attempts to repair the document, but some of 
the data at the end of the file is lost. The following are the maximum sizes of 
spreadsheets I could create w/o corruption:

8215 rows, 1 column
4107 rows, 2 columns
2738 rows, 3 columns

I am using JDK 1.4.2. I am using Excel 2002 SP-2.

The following is the code I used to produce the problem:

    public void createFile(String filename, int height, short width) throws 
Exception {
        FileOutputStream fileOut = new FileOutputStream(filename);
        
        HSSFWorkbook wb;
        HSSFSheet sheet;
        HSSFRow row;
        HSSFCell cell;
        
        int counter = 0;
        
        wb = new HSSFWorkbook();
        sheet = wb.createSheet("Test sheet");
        
        for (int i = 0; i < height; ++i) {
            row = sheet.createRow(i);
                       
            for (short s = 0; s < width; ++s) {
                ++counter;
                
                cell = row.createCell(s);
                cell.setCellValue(String.valueOf(counter));
            }
        }
        
        wb.write(fileOut);
        fileOut.close();        
    }
Comment 1 Avik Sengupta 2003-11-03 17:54:20 UTC
This has been fixed in 2.0RC1. But thanks for a pretty well researched bug report!

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