- 浏览: 430564 次
- 性别:
- 来自: 吉林→上海
文章分类
- 全部博客 (174)
- Java基础-接口与内部类 (5)
- Java基础-流与文件 (10)
- Java基础-JDBC (12)
- Java基础-XML解析 (7)
- Java基础-多线程 (11)
- Java基础-网络 (6)
- Java基础-注解 (5)
- Hibernate 研究记录 (7)
- JavaScript 研究记录 (6)
- ECMAScript 研究记录 (7)
- CSS 研究记录 (9)
- Maven 研究记录 (8)
- SQL 随笔 (5)
- 权限控制和单点登陆 (8)
- Hadoop 研究记录 (6)
- 随想杂谈 (33)
- JAVA EE (4)
- 测试 (3)
- Redis (10)
- Memcached (2)
- MongoDB (6)
- ElasticSearch (3)
最新评论
-
sgq0085:
无尘灬 写道楼主,在吗?可以加你qq咨询一下问题吗?公司禁用Q ...
Shiro通过Redis管理会话实现集群 -
无尘灬:
楼主,在吗?可以加你qq咨询一下问题吗?
Shiro通过Redis管理会话实现集群 -
zhouminsen:
感谢楼主的无私奉献
Shiro通过Redis管理会话实现集群 -
tonny1228:
经测试还是运行在local
远程调用执行Hadoop Map/Reduce -
asdhobby:
楼主,个人感觉每次调用SessionDAO的doUpdate方 ...
Shiro通过Redis管理会话实现集群
POI 读Excel非常简单,例子如下:
private Map<String, Object> readExcel(File excel) { Map<String, Object> result = new HashMap<String, Object>(); result.put("success", false); FileInputStream fis = null; Workbook wb = null; int saveCount = 0; try { try { fis = new FileInputStream(excel); wb = WorkbookFactory.create(fis); for (int s = 0; s < wb.getNumberOfSheets(); s++) { Sheet sheet = wb.getSheetAt(s); int rowNum = sheet.getPhysicalNumberOfRows(); if (rowNum < 1) { result.put("msg", "导入文件中没有数据"); return result; } for (int r = 0; r < rowNum; r++) { Row row = sheet.getRow(r); if (row == null) { continue; } int cells = row.getPhysicalNumberOfCells(); for (int c = 0; c < cells; c++) { Cell cell = row.getCell(c); String value = null; switch (cell.getCellType()) { case HSSFCell.CELL_TYPE_FORMULA: value = cell.getCellFormula(); break; case HSSFCell.CELL_TYPE_NUMERIC: value = cell.getNumericCellValue() + ""; if (value.endsWith(".0")) { value = value.substring(0, value.length() - 2); } break; case HSSFCell.CELL_TYPE_STRING: value = cell.getStringCellValue(); break; default: } System.out.println(value); } } } } catch (Exception e) { e.printStackTrace(); } } finally { try { fis.close(); } catch (IOException e) { e.printStackTrace(); } } result.put("msg", "导入[" + saveCount + "]条数据"); result.put("success", true); return result; }
关于问题:
"java.lang.NoClassDefFoundError: org/openxmlformats/schemas/*something*"
比如:org.openxmlformats.schemas.wordprocessingml.x2006
官网上有说明
I'm using the poi-ooxml-schemas jar, but my code is failing with "java.lang.NoClassDefFoundError: org/openxmlformats/schemas/*something*" To use the new OOXML file formats, POI requires a jar containing the file format XSDs, as compiled by XMLBeans. These XSDs, once compiled into Java classes, live in the org.openxmlformats.schemas namespace. There are two jar files available, as described in the components overview section. The full jar of all of the schemas is ooxml-schemas-1.1.jar, and it is currently around 15mb. The smaller poi-ooxml-schemas jar is only about 4mb. This latter jar file only contains the typically used parts though. Many users choose to use the smaller poi-ooxml-schemas jar to save space. However, the poi-ooxml-schemas jar only contains the XSDs and classes that are typically used, as identified by the unit tests. Every so often, you may try to use part of the file format which isn't included in the minimal poi-ooxml-schemas jar. In this case, you should switch to the full ooxml-schemas-1.1.jar. Longer term, you may also wish to submit a new unit test which uses the extra parts of the XSDs, so that a future poi-ooxml-schemas jar will include them. There are a number of ways to get the full ooxml-schemas-1.1.jar. If you are a maven user, see the the components overview section for the artifact details to have maven download it for you. If you download the source release of POI, and/or checkout the source code from subversion, then you can run the ant task "compile-ooxml-xsds" to have the OOXML schemas downloaded and compiled for you (This will also give you the XMLBeans generated source code, in case you wish to look at this). Finally, you can download the jar by hand from the POI Maven Repository. Note that for POI 3.5 and 3.6, the full ooxml schemas jar was named ooxml-schemas-1.0.jar. For POI 3.7, the filename was bumped to ooxml-schemas-1.1.jar when generics support was added. You can use ooxml-schemas-1.1.jar with POI 3.5 and 3.6 if you wish, but POI 3.7 won't wokr with ooxml-schemas-1.0.jar (it needs thew newer one).
简单来说官方lib中的poi-ooxml-schemas-3.9-20121203是一个缩水的版本,只提供常用的一些类。所以解决的办法就是导入ooxml-schemas-1.1.jar而不是poi-ooxml-schemas-3.9-20121203。
- ooxml-schemas-1.1.part2.rar (1.4 MB)
- 下载次数: 26
- ooxml-schemas-1.1.part1.rar (8 MB)
- 下载次数: 24
发表评论
-
bootstrap4 菜单
2018-09-04 16:59 01 菜单从左到右 .navbar-nav li:hove ... -
maven profile整合spring profile方式
2018-03-30 17:17 6501.POM中build-resources-resource ... -
Editplus或sublime不能打开的问题
2018-01-10 12:24 01. Windows 输入 regedit 后 回车 打开 ... -
jmeter对udp接口压测
2017-02-23 09:37 41421.下载JMeter http://jmeter.ap ... -
Tomcat启动时获取访问地址和端口号
2016-11-18 14:33 2252遇到一个单节点多实例部署的情况,且配置文件部署平台统一管理了 ... -
js实现表单跳转页面
2016-08-03 14:37 1125function router(page, param, i ... -
Spring JdbcTemplate释放连接
2016-07-22 17:01 6793前言 Spring JdbcTemplate在通过Dat ... -
通过siger获取系统信息
2015-11-04 16:09 2225一.简单介绍 Sigar(System Informat ... -
jqgrid在chrome下水平滚动条的处理方法
2015-07-29 12:52 2549chrome里默认的table计算值会比ie或者firefo ... -
MurmurHash一致性Hash算法JAVA版
2015-07-27 10:57 11511一.背景介绍 MurmurHash算法:高运算性能,低碰撞 ... -
Thrift 简单使用
2015-05-25 15:39 4523一.Thrift介绍 thrif ... -
Cron Expression语法
2015-04-15 13:14 2371前言 Cron表达式常被用于设置触发时间,比如Quart ... -
Jenkins简单使用
2015-04-15 14:42 7998环境 CentOS+JDK7+MAVEN3.2+SVN/ ... -
Java平台的内嵌脚本支持JSR223以及commons-jexl简单使用
2015-03-11 16:24 2731前言 JDK6加入对JSR233-Java平台脚本的支持 ... -
线程池ExecutorService/ThreadPoolTaskExecutor/common-pool
2015-03-11 14:44 0JAVA ExecutorService 一个 ... -
在Listener、Filter、Servlet中调用 spring 使用注解定义的bean
2015-03-10 16:56 59781.背景 ServletContext,是一个全 ... -
JDK7 NIO2 监控文件夹文件拷贝完成
2015-03-10 11:47 2392基于JDK7,监控某文件夹拷贝文件,监控本身很简单用Wat ... -
JVM运行时数据区域
2015-01-05 13:34 0程序计数器 是一块较小内存,可以看做当前线程所执行的字节 ... -
flyway 3.0 3.1配置指南
2014-08-21 14:58 2043介绍flyway这个数据库迁移的文章很多,但是没有针对最新 ... -
SiteMesh3简单研究笔记
2014-08-14 12:28 4876对应之前的SiteMesh2简 ...
相关推荐
poi3.9读写EXCEL 支持2007
poi3.9读写excel完美修订版本 java源码 兼容03和07 可运行 带详细注释 GX了
spring3.2.5 MVC Poi3.9 maven2 操作excel批量导入数据库和可以从数据库导出数据成excel表方便数据分析。
包含poi 3.9的jar 和其它相关的jar ,xmlbeans.jar 和org.slf4j.jar 还包含一个测试用例。
poi3.9对excel的操作性能显著提升,内容poi所需全部jar包,附带操作excel的简单事例,以供参考。
利用poi3.9做的excel导出工具。 这是一个工程直接压缩而成的。 测试10万行*8列,从查询到生成文件所花时间13620毫秒 测试100万行*8列,从查询到生成文件所花时间121443毫秒 主要目录: src com.util ----DBUtil.java...
Poi读取Excel2003+Excel2007 Poi生成Excel2003 源码,调用 方法即可
poi3.9java操作excel表格。poi3.9java操作excel表格。poi3.9java操作excel表格。
POI3.9涉及的业务jar包以及依赖包,用于操作EXCEL、WORD等
JAVA 使用poi技术处理Excel表导入、导出的包,将其导入到项目的lib的目录下就可以啦,我这里用的是3.9的
1.java利用poi-3.9操作excel,一个对比双色球一等奖号码的例子。 2.其中一个excel是用来生成双色球历史中奖数据的。 3.会创建新的excel来存放双色球中奖号码。
java 导出excel表格 插件 poi 3.9 poi-3.9.jar poi-ooxml-3.9.jar poi-ooxml-schemas-3.7.jar
可以解决import.org.apache.poi.*; 支持office全系excel文件解析。
通过POI3.9驱动模式读取excel2007时,对含有空的单位格处理实现,使用起来很简单了
struts2中利用poi导出excel的简单例子
用于poi操作excel创建、读取等操作
导出excel word的poi jar包 以及各种版本jar包 根据需要选择合适的jar包 网上一些代码实现方法 高版本的会移除一些方法 低版本的直接可以调用方法
poi3.9 poi3.10 poi3.15 dom4j的jar包集合,用于excel下载需要导入的包
这个我从官方的POI处下载的,打包成了API,欢迎下载