首页 > 其他 > 详细

Package should contain a content type part [M1.13]

时间:2014-08-06 18:09:01      阅读:1323      评论:0      收藏:0      [点我收藏+]

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

Package should contain a content type part [M1.13],布布扣,bubuko.com

Package should contain a content type part [M1.13]

原文:http://www.cnblogs.com/masw/p/3894756.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!