Commit 02f71096 authored by wujipeng's avatar wujipeng
Browse files

文件解析处理

parent d39b7ed4
...@@ -432,9 +432,17 @@ public class AnalysisServiceImpl implements AnalysisService { ...@@ -432,9 +432,17 @@ public class AnalysisServiceImpl implements AnalysisService {
String fileName = excelFile.getName().toLowerCase(); String fileName = excelFile.getName().toLowerCase();
if (fileName.endsWith(".xlsx")) { if (fileName.endsWith(".xlsx")) {
try {
return new XSSFWorkbook(new FileInputStream(excelFile)); return new XSSFWorkbook(new FileInputStream(excelFile));
} catch (Exception e) {
return new HSSFWorkbook(new FileInputStream(excelFile));
}
} else if (fileName.endsWith(".xls")) { } else if (fileName.endsWith(".xls")) {
try {
return new HSSFWorkbook(new FileInputStream(excelFile)); return new HSSFWorkbook(new FileInputStream(excelFile));
} catch (Exception e) {
return new XSSFWorkbook(new FileInputStream(excelFile));
}
} else { } else {
throw new IllegalArgumentException("不支持的Excel文件格式"); throw new IllegalArgumentException("不支持的Excel文件格式");
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment