poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 59732] New: File Excel Created From Apache POI Can't Open by Ms Excel (file corrupt)
Date Mon, 20 Jun 2016 07:22:48 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=59732

            Bug ID: 59732
           Summary: File Excel Created From Apache POI Can't Open by Ms
                    Excel (file corrupt)
           Product: POI
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: stefanoto@gmail.com

I don't know why the file I write using POI cant be opened by Ms Excel , but
the file is still readable by POI. (cell value can be changed) 

Link file:
http://www.corteconti.it/export/sites/portalecdc/_documenti/controllo/sez_autonomie/2016/schemi_di_bilancio_armonizzato_2015_ens_art_1_delibera_12_2016_sezaut_inpr.xls

here is the code

    String nomeFileArt1 =
"schemi_di_bilancio_armonizzato_2015_ens_art_1_delibera_12_2016_sezaut_inpr.xls";
        NPOIFSFileSystem fs = new NPOIFSFileSystem(new
File(System.getProperty("java.io.tmpdir") + nomeFileArt1));
        HSSFWorkbook wb = new HSSFWorkbook(fs.getRoot(), true);

        FileOutputStream stream = new
FileOutputStream(System.getProperty("java.io.tmpdir") +
"schemi_di_bilancio_armonizzato.xls");
        HSSFSheet sheet = wb.getSheet("Dati_Anagrafici");
        HSSFRow sheetrow = sheet.getRow(10);
        if (sheetrow == null) {
            sheetrow = sheet.createRow(10);
        }
        HSSFCell cell = sheetrow.getCell(0);
        if (cell == null) {
            cell = sheetrow.createCell(0);
            cell.setCellType(HSSFCell.CELL_TYPE_STRING);
        }
        cell.setCellValue("test");
        wb.write(stream);
        stream.close();

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message