Summary: | Excel: unreadable content error when opening POI generated xls in Excel on Windows 7 | ||
---|---|---|---|
Product: | POI | Reporter: | Eric Pias <eric.pias> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED WORKSFORME | ||
Severity: | normal | CC: | eric.pias |
Priority: | P2 | ||
Version: | 3.9-FINAL | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Attachments: |
Use this class to generate files that will not open in Excel under Windows 7
Excel workbook that opens successfully. |
Description
Eric Pias
2013-02-20 18:02:34 UTC
Created attachment 29980 [details]
Excel workbook that opens successfully.
Hm, looks like I was able to upload the attachment but my comments were lost. Anyway, I was unable to re-create the problem. Currently, I am running under Windows 7, 64 bit Home Premium and the class I wrote was compiled and run against version 1.6.0_33 of Sun's (Oracle's) Java implementation and version 3.9 of POI. I did not use the exact code you posted - forgot to save the code to my PC - but wrote my own class to perform the test: import java.io.*; import org.apache.poi.hssf.usermodel.*; /** * * @author Mark Beardsley */ public class OpenError { public OpenError(String filename) throws IOException { HSSFWorkbook workbook = null; HSSFSheet sheet = null; FileOutputStream fos = null; try { workbook = new HSSFWorkbook(); sheet = workbook.createSheet("In Error."); fos = new FileOutputStream(filename); workbook.write(fos); } finally { if(fos != null) { fos.close(); } } } } The only difference between the two being that I did not flush the output stream but I cannot imagine that will make a profound difference. Some time ago, I do remember problems with building the api with version 1.7 of Java but know that Yegor planned to address this and am fairly certain that he has. Could you try to open the attached Excel workbook using your version of Excel and see what happens please? It may well be that it is the version of Excel you are using which is important rather than the operating system. needinfo based on previous comment This issue was definitely seen in our testing. Unfortunately, we are currently unable to replicate this issue anymore after much trying. There are a number of different factors involved that make it difficult. I hate to see anyone burning cycles on this, so I will attempt to close/resolve it. |