jeecg_scott 发表于 2013-5-14 20:53:05

excel导入模板

excel导入模板


cian 发表于 2013-5-14 21:27:52

还是不行啊!

GIN 发表于 2013-5-14 21:32:14

cian 发表于 2013-5-14 21:27 static/image/common/back.gif
还是不行啊!

后台错误堆栈贴来看看

jeecg_scott 发表于 2013-5-14 21:51:39

GIN 发表于 2013-5-14 21:32 static/image/common/back.gif
后台错误堆栈贴来看看

我看看这两天先发一个bata版本吧,这个版本的导入导出例子做了更好的测试

cian 发表于 2013-5-14 21:53:52

GIN 发表于 2013-5-14 21:32 static/image/common/back.gif
后台错误堆栈贴来看看

java.lang.IllegalStateException: Cannot get a numeric value from a text cell
      at org.apache.poi.hssf.usermodel.HSSFCell.typeMismatch(HSSFCell.java:637
)
      at org.apache.poi.hssf.usermodel.HSSFCell.getNumericCellValue(HSSFCell.j
ava:662)
      at org.jeecgframework.core.util.excel.ExcelUtil.importExcelByIs(ExcelUti
l.java:821)
      at jeecg.demo.controller.test.JpPersonController.implXls(JpPersonControl
ler.java:140)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.
invokeHandlerMethod(HandlerMethodInvoker.java:176)
      at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandle
rAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
      at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandle
rAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(Dispatch
erServlet.java:923)
      at org.springframework.web.servlet.DispatcherServlet.doService(Dispatche
rServlet.java:852)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(Frame
workServlet.java:882)
      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServ
let.java:789)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
      at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.j
ava:140)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
equestFilter.java:70)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterIntern
al(CharacterEncodingFilter.java:88)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
equestFilter.java:76)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
      at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.do
FilterInternal(OpenSessionInViewFilter.java:119)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
equestFilter.java:76)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:103)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:293)
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcesso
r.java:879)
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.pr
ocess(Http11AprProtocol.java:617)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:17
60)
      at java.lang.Thread.run(Thread.java:722)
java.lang.NullPoint
erException
      at jeecg.demo.controller.test.JpPersonController.implXls(JpPersonControl
ler.java:141)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.
invokeHandlerMethod(HandlerMethodInvoker.java:176)
      at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandle
rAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
      at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandle
rAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(Dispatch
erServlet.java:923)
      at org.springframework.web.servlet.DispatcherServlet.doService(Dispatche
rServlet.java:852)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(Frame
workServlet.java:882)
      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServ
let.java:789)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
      at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.j
ava:140)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
equestFilter.java:70)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterIntern
al(CharacterEncodingFilter.java:88)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
equestFilter.java:76)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
      at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.do
FilterInternal(OpenSessionInViewFilter.java:119)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerR
equestFilter.java:76)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:103)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:293)
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcesso
r.java:879)
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.pr
ocess(Http11AprProtocol.java:617)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:17
60)
      at java.lang.Thread.run(Thread.java:722)

cian 发表于 2013-5-14 22:00:10

cian 发表于 2013-5-14 21:53 static/image/common/back.gif
java.lang.IllegalStateException: Cannot get a numeric value from a text cell
      at org.apache ...

jeecg_scott 有心了,也不要急,慢慢来!!!只是我这人代码跑不通就抓狂!!!同事都说我没救了:)

niaolianyu 发表于 2013-5-22 11:31:08

本帖最后由 niaolianyu 于 2013-5-22 11:46 编辑

scott提供的模板 里面全为文本格式
所以导入有问题
另外 有个地方加一行
else if (xclass.equals("class java.lang.Integer"))
{
// 先设置Cell的类型,然后就可以把纯数字作为String类型读进来了:
cell.setCellType(Cell.CELL_TYPE_STRING);
setMethod.invoke(tObject, new Integer(cell.getStringCellValue()));
}

里面的格式用正常格式 日期用日期格式
下面的日期格式没带 时间信息倒入是没有问题的
带时间信息的可以自己测试
修改上面的后
导入没有问题
正式的等scott的正式版吧

用下面的倒入


westlake 发表于 2013-5-23 13:25:08

:lol我也是这样改的,框架里的好些功能都不完整,比如上传下载等,需要自己动手完善起来...

yjundoit 发表于 2013-12-11 10:24:12

我按照说明做了一个excel的导入demo,我要导入的excel中有6条数据,导入的时候生成的list的size也是6,但是list中每个对象的每个属性都是null这是为什么?
页: [1]
查看完整版本: excel导入模板