Excel中创build的文件Excel无法通过Ms Excel打开(文件损坏)
我不知道为什么使用POI编写的文件无法由Ms Excel打开,但是文件仍然可以被POI读取。 (单元格值可以更改)我使用Apache-Poi 3.10 Final和JDK 1.5
链接文件: 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
这里是代码
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();
- 有人可以提供代码/逻辑来检索excel(.xlsx)数据,比如“”driver.findElement(By.id(“”))。sendkeys(getExceldata(row,column));“
- 使用Apache POI从string读取excel文件
- apache poi excel小时格式设置单元格值java
- POI无法打开在Excel中打开的工作簿
- 如何通过使用Apache POI来同时合并单元格和设置值?
- 使用apache POIreplaceword文档中的文本会失败,因为段落运行对象在占位符处被分割
- 如何在使用java的Excel基础上编写csv文件?
- 阅读大型Excel文件.xlsx
- Java POI中的InvalidFormatException