- 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解析不了");
- }
创建HSSFWorkbook或XSSFWorkbook对象的方法
最新推荐文章于 2024-06-21 10:55:06 发布