使用poi异常:Package should contain a content type part [M1.13]
2015-01-18 20:24
429 查看
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
参考文章:http://blog.csdn.net/llwan/article/details/8890190
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
参考文章:http://blog.csdn.net/llwan/article/details/8890190
相关文章推荐
- Package should contain a content type part [M1.13]
- Java之POI读取Excel的Package should contain a content type part [M1.13]] with root cause异常问题解决
- Java之POI读取Excel的Package should contain a content type part [M1.13]] with root cause异常问题解决
- 关于读取Excel文件报错的问题(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]
- 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]
- 解决异常:Package should contain a content type part [M1.13]
- The content of element type "package" must match "(result-types?,interceptors?,default-intercept
- The content fo element type "package" must match
- struts2配置文件错误(The content of element type “package” must match**)
- struts2---The content of element type "package" must match "(result-types?,interceptors?,default-int
- Orchard:把之前写的Map Content Part专为一个Widget来使用
- 在ASP.NET中使用ContentType="类型名";来确定输出格式
- 如果出现The content of element type "package" must match "(result-types?,interceptors?,default-interce
- 在ASP.NET中使用Response.ContentType="类型名"
- The content of element type "package" must match "(result-types?,interceptors?...