I use JasperViewerto display a report to the user and to export to pdf, wordand Excel. The problem is saving on Excel, and the error prompts say:
Exception in thread "AWT-EventQueue-0" java.lang.VerifyError: (class: net/sf/jasperreports/engine/export/JRXlsExporter,
method: createMergeRegion signature: (Lnet/sf/jasperreports/engine/export/JRExporterGridCell;IILorg/apache/poi/hssf/usermodel/HSSFCellStyle;)V) Incompatible argument to function
at net.sf.jasperreports.view.save.JRSingleSheetXlsSaveContributor.save(JRSingleSheetXlsSaveContributor.java:104)
at net.sf.jasperreports.swing.JRViewerToolbar.btnSaveActionPerformed(JRViewerToolbar.java:407)
Here is the code that I use to show my report:
public void showReport() throws SQLException {
RNVehicle rnVehicle = new RNVehicle();
vehicles.clear();
vehicles= rnVehicle.getVehiculos();
String reportName = "reports/ReportVehicles.jasper";
InputStream is = this.getClass().getClassLoader().getResourceAsStream(reportName);
try {
JasperPrint jp = JasperFillManager.fillReport(is, null, new JRBeanCollectionDataSource(vehicles));
JRViewer jv = new JRViewer(jp);
JFrame jf = new JFrame();
jf.getContentPane().add(jv);
jf.validate();
jf.setVisible(true);
jf.setSize(new Dimension(1020, 755));
jf.setLocation(0, 0);
jf.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
} catch (JRException ex) {
ex.printStackTrace();
}
}
I am desperate :( why doesn’t it work? What changes should I make? Or which libraries should I import into the project in order to start it?
At the moment I have: poi-3.6.jar(the one that comes with the JR distribution), I also tried with previous versions 3.5 and 3.2 and everything works fine with all of them, but only for html, pdf and word, and not for Excel.
Any understanding of this issue would be helpful.