解决异常:Package should contain a content type part [M1.13]
2015-01-04 16:25
375 查看
上午遇到个问题
看了下源码public static Workbook create(InputStream in) throws
IOException,InvalidFormatException {
if (!in.markSupported()) {
in = new PushbackInputStream(in, 8);
}
if (POIFSFileSystem.hasPOIFSHeader(in)) {
return new HSSFWorkbook(in);
}
if (POIXMLDocument.hasOOXMLHeader(in)) {
return new XSSFWorkbook(OPCPackage.open(in));
}
throw new IllegalArgumentException("你的excel版本目前poi解析不了");
}
读写xls和xlsx格式时,HSSFWorkbook针对xls,XSSFWorkbook针对xlsx
格式的问题!
org.apache.poi.POIXMLException: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13]
看了下源码public static Workbook create(InputStream in) throws
IOException,InvalidFormatException {
if (!in.markSupported()) {
in = new PushbackInputStream(in, 8);
}
if (POIFSFileSystem.hasPOIFSHeader(in)) {
return new HSSFWorkbook(in);
}
if (POIXMLDocument.hasOOXMLHeader(in)) {
return new XSSFWorkbook(OPCPackage.open(in));
}
throw new IllegalArgumentException("你的excel版本目前poi解析不了");
}
读写xls和xlsx格式时,HSSFWorkbook针对xls,XSSFWorkbook针对xlsx
格式的问题!
相关文章推荐
- Java之POI读取Excel的Package should contain a content type part [M1.13]] with root cause异常问题解决
- 解决异常:Package should contain a content type part [M1.13]
- Java之POI读取Excel的Package should contain a content type part [M1.13]] with root cause异常问题解决
- 解决异常:Package should contain a content type part [M1.13]
- Java之POI读取Excel的Package should contain a content type part [M1.13]] with root cause异常问题解决
- Package should contain a content type part [M1.13]
- Package should contain a content type part [M1.13]
- Package should contain a content type part [M1.13]
- new XSSFWorkbook(is); Package should contain a content type part [M1.13]
- 关于读取Excel文件报错的问题(Package should contain a content type part [M1.13])
- 使用poi异常:Package should contain a content type part [M1.13]
- 解决fastjson出现java.lang.IllegalArgumentException:'Content-Type' cannot contain wildcardt *
- POI 操作Excel 异常org.apache.poi.openxml4j.exceptions.invalidformatexception: package should contain a c
- "org.xml.sax.SAXParseException: The content of element type "class" must match" 异常解决
- he content of element type "struts" must match "((package|include|bean|constant)*,unknown-handler-stack?)".解决方法
- he content of element type "struts" must match "((package|include|bean|constant)*,unknown-handler-stack?)".解决方法
- 关于Translation failed for content-type:text/vnd.wap.wml的解决方法
- struts2关于A web application created a ThreadLocal with key of type 异常解决办法
- struts.xml中提示content of element type "package" must match
- 如果出现The content of element type "package" must match "(result-types?,interceptors?,default-interce