use of com.jeesuite.common2.excel.convert.XLSX2CSV in project jeesuite-libs by vakinge.
the class ExcelPerfModeReader method readAsXLSX.
private List<String> readAsXLSX(String path) {
OPCPackage opcPackage = null;
try {
opcPackage = OPCPackage.open(path, PackageAccess.READ);
XLSX2CSV xlsx2csv = new XLSX2CSV(opcPackage, System.out, -1);
return xlsx2csv.process();
} catch (Exception e) {
if (e instanceof OLE2NotOfficeXmlFileException || e instanceof NotOLE2FileException || e instanceof NotOfficeXmlFileException || e instanceof OfficeXmlFileException) {
throw new ExcelOperBaseException("请选择正确格式excel文件");
}
if (e instanceof IOException) {
throw new ExcelOperBaseException("文件读取失败");
}
if (e instanceof InvalidOperationException) {
throw new ExcelOperBaseException(e);
}
throw new RuntimeException(e);
} finally {
try {
opcPackage.close();
} catch (Exception e) {
}
}
}
Aggregations