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

mac2022-06-30  19

http://blog.csdn.net/llwan/article/details/8890190

——————————————————————————————————————————————————————————————————————————————————

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

 

转载于:https://www.cnblogs.com/cuizhf/p/3878031.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)