poi java 其他_java.lang.NoSuchMethodError:org.apache.poi.hssf.usermodel.HSSFWorkbook.createDataFormat(...

我有一些麻烦将我的报告导出为XLS. PDF格式的导出效果很好.

所以我尝试更新到最新的JasperReports和Apache POI版本:

> JasperReports:5.5.0

> POI:3.7

> iText:2.1.7

但我总是收到以下异常:

java.lang.NoSuchMethodError: org.apache.poi.hssf.usermodel.HSSFWorkbook.createDataFormat()Lorg/apache/poi/hssf/usermodel/HSSFDataFormat;

net.sf.jasperreports.engine.export.JRXlsExporter.openWorkbook(JRXlsExporter.java:284)

net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReportToStream(JRXlsAbstractExporter.java:927)

net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReport(JRXlsAbstractExporter.java:697)

com.phoenix.customermonitor.print.GenericDataSourceApp.xls(GenericDataSourceApp.java:290)

com.phoenix.customermonitor.print.GenericDataSourceApp.exportToFormat(GenericDataSourceApp.java:335)

com.phoenix.core.JasperReportHandlerAction.exportOrderMonitorOverview(JasperReportHandlerAction.java:242)

com.phoenix.customermonitor.action.OrderMonitorMainAction.execute(OrderMonitorMainAction.java:217)

org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)

org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)

org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)

org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)

org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)

org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)

org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)

org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)

org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)

javax.servlet.http.HttpServlet.service(HttpServlet.java:643)

javax.servlet.http.HttpServlet.service(HttpServlet.java:723)

出口代码

File sourceFile = new File(fileIn);

JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

String name = fileIn.substring(fileIn.lastIndexOf(System.getProperty("file.separator"))+1);

name = name.substring(0, name.lastIndexOf("."));

File destFile = new File(fileOut);

JRXlsExporter exporter = new JRXlsExporter();

exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);

exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());

exporter.exportReport();

经过一些研究,我尝试了其他几个版本(4),但我仍然收到此错误.有谁知道解决方案?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值