流读取文件时可能报以下错误:
java.io.IOException: Your InputStream was neither an OLE2 stream, nor an OOXML streamat org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:258)at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:221)at com.ruoyi.common.utils.poi.ExcelUtil.importExcel(ExcelUtil.java:186)at com.ruoyi.common.utils.poi.ExcelUtil.importExcel(ExcelUtil.java:173)
解决方法很简单,在项目的pom.xml文件内新增或补足以下代码块
<plugin> <groupId>org.apache.maven.pluginsgroupId> <artifactId>maven-resources-pluginartifactId> <configuration> <encoding>UTF-8encoding> <nonFilteredFileExtensions> <nonFilteredFileExtension>xlsxnonFilteredFileExtension> <nonFilteredFileExtension>xlsnonFilteredFileExtension> nonFilteredFileExtensions> configuration>plugin>
来源地址:https://blog.csdn.net/spec_king/article/details/132232237