excel支持2013版本和2017版本

创建提个工具类XlsImpUtil

public class XlsImpUtil {public static Workbook create(InputStream inp) throws IOException, InvalidFormatException {if (!inp.markSupported()) {inp = new PushbackInputStream(inp, 8);}if (POIFSFileSystem.hasPOIFSHeader(inp)) {return new HSSFWorkbook(inp);}if (POIXMLDocument.hasOOXMLHeader(inp)) {return new XSSFWorkbook(OPCPackage.open(inp));}throw new IllegalArgumentException("你的excel版本目前poi解析不了");}}
Workbook xssfWorkbook = XlsImpUtil.create(inputStream);Sheet xssSheet0 = xssfWorkbook.getSheetAt(0);Cell 使用cell

 

本文链接:https://my.lmcjl.com/post/13965.html

展开阅读全文

4 评论

留下您的评论.