Package should contain a content type part [M1.13]异常的解决方式

Posted 轻尘如风

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Package should contain a content type part [M1.13]异常的解决方式相关的知识,希望对你有一定的参考价值。

此异常的源代码如下:

 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就没有问题了

以上是关于Package should contain a content type part [M1.13]异常的解决方式的主要内容,如果未能解决你的问题,请参考以下文章

Package should contain a content type part [M1.13]异常的解决方式

'version' contains an expression but should be a constant

npm notice created a lockfile as package-lock.json. You should commit this file.

npm notice created a lockfile as package-lock.json. You should commit this file.

npm notice created a lockfile as package-lock.json. You should commit this file.

Why containers? Why should we care?