DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43949>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43949

           Summary: corrupted damaged xls file (corrupted, excel repairs it
                    during opening)
           Product: POI
           Version: 3.0
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


Hello.

My POI-Version: poi-bin-3.0.1-FINAL-20070705.zip

I've generated XLS-File with:

                try {
                        HSSFWorkbook wb = new HSSFWorkbook();
                        HSSFCellStyle styleDate = wb.createCellStyle();
                        
styleDate.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy"));

                        if (result != null) {
                                // create a new sheet
                                HSSFSheet s = wb.createSheet();

                                // declare a row object reference
                                HSSFRow r = null;

                                // declare a cell object reference
                                HSSFCell c = null;

                                wb.setSheetName(0, "RemovalInstallationList");

                                // first row with headings
                                r = s.createRow(0);

                                c = r.createCell((short) 0);
                                c.setCellValue(new HSSFRichTextString("Three 
Letter Code"));
                        
                                ....

                                c = r.createCell((short) 37);
                                c.setCellValue(new 
HSSFRichTextString("Description"));
                                
                                s.setColumnWidth((short) (0), (short) ((50 * 4) 
/ ((double) 1 / 20)));
                        
                                ....

                                s.setColumnWidth((short) (37), (short) ((50 * 
4) / ((double) 1 / 20)));
                                
                                Iterator it = result.iterator();
                                for (int i = 0; it.hasNext(); i++) {
                                        RemovalInstallationReportResultRowModel 
resultModel = null;
                                        resultModel = 
(RemovalInstallationReportResultRowModel) it.next();

                                        // create a row with data
                                        r = s.createRow(i + 1);

                                        c = r.createCell((short) 0);
                                        if (resultModel.getThreeLC() != null) {
                                                c.setCellValue(new 
HSSFRichTextString(resultModel.getThreeLC()));
                                        } else {
                                                c.setCellValue(new 
HSSFRichTextString(""));
                                        }
                        
                                        ....

                                        c = r.createCell((short) 37);
                                        if 
(resultModel.getDescriptionPartNoInstalledComponent() != null) {
                                                c.setCellValue(new
HSSFRichTextString(resultModel.getDescriptionPartNoInstalledComponent()));
                                        } else {
                                                c.setCellValue(new 
HSSFRichTextString(""));
                                        }
                                }
                                return new 
RemovalInstallationReportCSVModel(Status.OK, wb.getBytes());
                        }
                        
                        calling method:
                        
                        byte[] resultAsByte = csvModel.getTransferObject();
                        if (result != null) {
                        inputStream = new ByteArrayInputStream(resultAsByte);
                }
                input();
                return "exportCSV";             


    Struts-Config.xml

                <result name="exportCSV" type="stream">
                          <param 
name="contentType">application/vnd.ms-excel</param>
                          <param name="inputName">inputStream</param>
                          <param 
name="contentDisposition">filename="document.xls"</param>
                </result>
                
                The result is a message from Excel during opening the file like:
                
                Microsoft Excel Datei-Reparatur Protokoll

                In Datei 'D:\tmp\exported_file_damaged_231107.xls' wurden 
Fehler festgestellt
                Die folgenden Reparaturen wurden durchgeführt:
                Die Zusammenfassungs-Information des Dokumentes ist verloren 
gegangen.

The resulting exported file is attached.

Kind regards.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to