-
Notifications
You must be signed in to change notification settings - Fork 7.6k
解析excel 用推荐的ExcelReader不传ExcelTypeEnum的方法 就无法识别他的类型 #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
我也遇到同样的问题 |
使用1.1.1不传ExcelTypeEnum会报错,内容如下:
com.alibaba.excel.exception.ExcelAnalysisException: Analyse excel occur file error fileType XLSX |
请问,问题解决了吗? |
我使用POI4.0.0还会报错。下面有一个回答提供了一个解决方案: public void read(String filePath,ExcelTypeEnum type,AnalysisEventListener<T> listener,
Class<T> model,boolean isTrim) throws IOException{
File excelFile = new File(filePath);
if(!excelFile.exists()){
throw new NotFoundFileException("This file was not found, and the target path is:[ "+
filePath +" ]");
}
//使用BufferedInputStream装饰一下FileInputStream
read(new BufferedInputStream(new FileInputStream(filePath)),type,listener,model,isTrim);
} |
…情况下),导致后续真正读取文件时报错 相关issue alibaba#115
1.1.2-beat2处理了这个问题,但是如果是03版excel需要在输入流左一层new BufferedInputStream(new FileInputStream("/xxxx/xxx/77.xls")确保markSupported 返回true |
2.2.10同样的问题 |
属实 |
Uh oh!
There was an error while loading. Please reload this page.
` public static void noModelMultipleSheet() {
InputStream inputStream=null;
try {
inputStream = new FileInputStream("C:\Users\xurong\Desktop\abc.xlsx");
com.alibaba.excel.exception.ExcelAnalysisException: Analyse excel occur file error fileType XLSX
at com.alibaba.excel.analysis.ExcelAnalyserImpl.getSaxAnalyser(ExcelAnalyserImpl.java:34)
at com.alibaba.excel.analysis.ExcelAnalyserImpl.analysis(ExcelAnalyserImpl.java:53)
at com.alibaba.excel.ExcelReader.read(ExcelReader.java:92)
at com.example.demo.DockerTestController.noModelMultipleSheet(DockerTestController.java:47)
at com.example.demo.DockerTestController.main(DockerTestController.java:26)
Caused by: org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException: No valid entries or contents found, this is not a valid OOXML (Office Open XML) file
at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:286)
at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:756)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:327)
at com.alibaba.excel.analysis.v07.XlsxSaxAnalyser.(XlsxSaxAnalyser.java:44)
at com.alibaba.excel.analysis.ExcelAnalyserImpl.getSaxAnalyser(ExcelAnalyserImpl.java:31)
... 4 more
The text was updated successfully, but these errors were encountered: