Jasperreport Excel文件创建异常

时间:2011-11-30 08:26:59

标签: java excel exception netbeans jasper-reports

在jasper报告中创建.xls文件时出现错误。 的异常

Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: org.apache.poi.hssf.usermodel.HSSFSheet.addMergedRegion(Lorg/apache/poi/hssf/util/CellRangeAddress;)I
at net.sf.jasperreports.engine.export.JRXlsExporter.createMergeRegion(JRXlsExporter.java:596)
at net.sf.jasperreports.engine.export.JRXlsExporter.initCreateCell(JRXlsExporter.java:540)
at net.sf.jasperreports.engine.export.JRXlsExporter.createTextCell(JRXlsExporter.java:530)
at net.sf.jasperreports.engine.export.JRXlsExporter.exportText(JRXlsExporter.java:390)
at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportPage(JRXlsAbstractExporter.java:550)
at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReportToStream(JRXlsAbstractExporter.java:423)
at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReport(JRXlsAbstractExporter.java:207)
at net.sf.jasperreports.view.save.JRSingleSheetXlsSaveContributor.save(JRSingleSheetXlsSaveContributor.java:112)
at net.sf.jasperreports.view.JRViewer.btnSaveActionPerformed(JRViewer.java:1128)
at net.sf.jasperreports.view.JRViewer$3.actionPerformed(JRViewer.java:668)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at 

代码

File reportFile = new File("C:/Documents and Settings...../report1.jrxml");
JasperDesign jasperDesign = JRXmlLoader.load(reportFile);
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, conn);
JasperViewer jv = new JasperViewer(jasperPrint);

但我能够生成其他类型的报告文件。这个excell文件正在生成,但数据不在文件中。我使用 jasperreports.jar 文件。这是由于弃用我想。我怎么解决这个问题?

0 个答案:

没有答案