此异常的源代码如下:

 1 public static Workbook create(InputStream in) throws       
 2     IOException,InvalidFormatException {  
 3         if (!in.markSupported()) {  
 4             in = new PushbackInputStream(in, 8);  
 5         }  
 6         if (POIFSFileSystem.hasPOIFSHeader(in)) {  
 7             return new HSSFWorkbook(in);  
 8         }  
 9         if (POIXMLDocument.hasOOXMLHeader(in)) {  
10             return new XSSFWorkbook(OPCPackage.open(in));  
11         }  
12         throw new IllegalArgumentException("你的excel版本目前poi解析不了");  
13     }  

解决方式:

读写xls和xlsx格式时,HSSFWorkbook针对xls,XSSFWorkbook针对xlsx

主要是格式的问题!

作者主要是将xls文件格式改成了xlsx就没有问题了

相关文章:

  • 2021-07-02
  • 2021-08-10
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2021-11-01
相关资源
相似解决方案