POI HSSF读写Excel问题
附件中是个Excel2003可以打开的文件(https://issues.apache.org/bugzilla/attachment.cgi?id=24273),但是用POI HSSF读取该文件不作任何操作然后保存为另一个文件,则新生成的文件用Excel2003打开会有以下错误:
POI版为3.2final,并且在最新的3.5dev以及3.8beta版都试过,都是不行
"Excel found unreadable content in "testUnreadablenew.xls". Do you want to recover the contents of this workbook?..."
然后实际恢复之后,文件中丢失了数据。下面是代码:
有谁碰到过类似问题么,谢谢~
POI版为3.2final,并且在最新的3.5dev以及3.8beta版都试过,都是不行
"Excel found unreadable content in "testUnreadablenew.xls". Do you want to recover the contents of this workbook?..."
然后实际恢复之后,文件中丢失了数据。下面是代码:
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();
}
}
有谁碰到过类似问题么,谢谢~
...全文
相关推荐
(实例)java poi完美解决excel2003和2007、2010之间兼容问题
**HSSF与XSSF的使用**: - HSSF API适用于读写.xls文件,它提供了对Excel 97-2003格式的支持。
poi-3.8-POI-HSSF和POI-XSSF和SXSSF.rar
HSSF (Horrible Spreadsheet Format):这是POI项目早期开发的一个API,用于读写Microsoft Excel的老版本文件,即.BIFF8格式,通常对应Excel 97
Jakata Poi HSSF:纯java的Excel解决方案
HSSF(Horrible Spreadsheet Format)是 POI 项目的一个接口,专门用于读写微软 Excel 的二进制文件格式(.xls)。
org.apache.poi.hssf.converter,office转html所需包
**HSSF API**:这是Apache POI提供用于读写旧版Excel文件的接口。
poi3.9读写excel兼容03和07版本
**数据公式处理**:POI支持读写Excel公式,包括计算公式的结果。7.


