我想将xls
文件转换为xlsx
文件,但在阅读XLS时,会收到错误。
public static void main(String[] args) throws Exception{
xlsTOxlsx xls=new xlsTOxlsx();
InputStream isXls = new FileInputStream("/xyz/MUM_FIN_DATA_BI_1jul16.XLS");
HSSFWorkbook workbookOld = new HSSFWorkbook(isXls);
String dest="/media/ram/Project/Apollo/MUMFINDATABI1jul16.XLSX";
FileOutputStream out = new FileOutputStream(dest);
XSSFWorkbook workbookNew = new XSSFWorkbook();
xls.transformHSSF( workbookOld , workbookNew) ;
workbookNew.write(out);
out.close();
}
我收到了以下错误 HSSFWorkbook workbookOld = new HSSFWorkbook(isXls):
线程中的异常" main" java.io.IOException:标头无效 签名;读取0x0A0D3E6C6D74683C,预期为0xE11AB1A1E011CFD0
在谷歌之后我发现了以下几点:
但是我怎么能用java代码呢?