Hello I have a similar problem as bug 15375 but I can simulate it with very little code. Here is a class that creates two spreadsheets, one good and one bad. import java.io.FileOutputStream; 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; /** * HSSFTest.java * * @author mjeffery * @created 2003/07/16 * @version 1a */ public class HSSFTest { HSSFWorkbook wb = null; HSSFSheet sheet = null; HSSFRow row = null; HSSFCell cell = null; public void createSheetThatCanOpen() { try { wb = new HSSFWorkbook(); sheet = wb.createSheet(); for (int i = 0; i < 6000; i++) { row = sheet.createRow((short)i); cell = row.createCell((short)0); cell.setCellValue("Test0"); cell = row.createCell((short)1); cell.setCellValue("Test1"); cell = row.createCell((short)2); cell.setCellValue("Test2"); } FileOutputStream fileOut = new FileOutputStream("c:/warrawarra/good.xls"); wb.write(fileOut); fileOut.close(); } catch (Exception e) { e.printStackTrace(); } } public void createSheetThatCannotOpen() { try { wb = new HSSFWorkbook(); sheet = wb.createSheet(); String tmp1 = null; String tmp2 = null; String tmp3 = null; for (int i = 0; i < 6000; i++) { tmp1 = "Test1" + i; tmp2 = "Test2" + i; tmp3 = "Test3" + i; row = sheet.createRow((short)i); cell = row.createCell((short)0); cell.setCellValue(tmp1); cell = row.createCell((short)1); cell.setCellValue(tmp2); cell = row.createCell((short)2); cell.setCellValue(tmp3); } FileOutputStream fileOut = new FileOutputStream("c:/warrawarra/bad.xls"); wb.write(fileOut); fileOut.close(); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { HSSFTest test = new HSSFTest(); test.createSheetThatCanOpen(); test.createSheetThatCannotOpen(); } } It seems as if when passing a hardcoded String to the setCellValue method it works fine but when passing a variable String it does not correctly create the spreadsheet. The strange thing is when reducing the loop size to 50 in the createSheetThatCannotOpen() method, it works fine ? This problem does not exist in jakarta-poi-1.5.1-final-20020615. Any help will be appreciated.
Created attachment 7327 [details] Class that simulates the described bug
we should fix this.
I have noticed that (In my case) as soon as the SST table becomes very big this happens. I can put thousands of strings into a spreadsheet as long as there are not too many unique ones. As soon as there are plenty unique strings the sheet can't open. Using the BIFF Viewer, I see that CONTINUE RECORD's are written for the spreadsheet that can't open and none are written for a spreadsheet that can open. From looking at the source (I am not sure though) it seems that these CONTINUE RECORDs are a major change between POI 1.5.1 and POI2. Am I on the wrong track ???
Hello I have a similiar problem while populating the excel sheet. if the rows are more then 3000(Apprx 640kb). then i am not able to open the excel file. It just flash. Else it is ok. Iam populating the excel sheet from database. I can see the size of the downloaded file eg: 900kb. Let me know if you have any resolution for this. Or any planned fix for the bug. Do you think the size may be the problem. thanks Sanjay
This is the same as bug 15375. The testcase here has been attached to 15375 as well. Marking this invalid, please track 15375 (not marking this as duplicate since the mailing list on 15375 is already more than 10 people, dont want to spam them further!!)
Will mark this as duplicate to ensure correct records for future use!
*** This bug has been marked as a duplicate of 15375 ***