https://issues.apache.org/bugzilla/show_bug.cgi?id=47847

           Summary: Read XLS via HSSFWorkbook and write back, file
                    unreadable by MS Excel 2003
           Product: POI
           Version: 3.5-dev
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Read the XlS file via HSSFWorkbook and do nothing except write the workbook
back, then the file goes unreadable by MS Excel 2003.

The following is the code:

FileInputStream fis = null;
HSSFWorkbook wb = null;
try{
    File f = new File("testUnreadable.xls");
    if (f.exists()){
        fis = new FileInputStream(f);
        wb = new HSSFWorkbook(fis);
    }
}catch (Throwable th){}
finally{
    if (fis != null){
        fis.close();
    }
}
FileOutputStream stream = null;
try{
    stream = new FileOutputStream("New.xls");
    wb.write(stream);
}catch (Exception e){}
finally{
    if (stream != null)
    {
        stream.close();
    }
}

when opening the generated "new.xls" file with MS Excel 2003, the following
error message pops up:

"Excel found unreadable content in "testUnreadablenew.xls". Do you want to
recover the contents of this workbook?..."

Is there any work around? Thanks a lot.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to