Package should contain a content type part [M1.13]
2015-11-09 15:20
423 查看
此文转载http://blog.csdn.net/llwan/article/details/8890190?source=1
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
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
相关文章推荐
- IntelliJ IDEA 官方网站 http://www.jetbrains.com/idea/
- wait sleep区别
- Goldengate 源端 dump进程无法启动报;scoket buffer size set to xxx connect failed to targetIP:7819,error
- mybtais 映射文件参数简写
- jetbrain kotlin试用笔记
- ADS编译问题
- raise()函数
- Daily Scrum (2015/11/8)
- mac 命令行 安装 需要管理员 权限“Please try running this command again as root/Administrator”的解决办法
- 文本处理命令系列――head和tail
- http://blog.csdn.net/altair86/article/details/8972178
- Paint.Join与Paint.Cap
- 利用AIDL来实现由Binder进行进程间通信(IPC)
- tail 显示文件最后若干行内容
- [LeetCode]66. Factorial Trailing Zeros阶乘的尾零个数
- How do I remap certain keys or devices?
- Paint House II 解答
- Paint House 解答
- Daily Scrum meeting 2015.11.9
- 解读:全国100强企业为何选择TurboMail邮件系统