Save to Excel from JasperViewer

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();

        //Path to your .jasper file in your package
        String reportName = "reports/ReportVehicles.jasper";

        //Get a stream to read the file
        InputStream is = this.getClass().getClassLoader().getResourceAsStream(reportName);

        try {

            JasperPrint jp = JasperFillManager.fillReport(is, null, new JRBeanCollectionDataSource(vehicles));

            //Viewer for JasperReport
            JRViewer jv = new JRViewer(jp);

            //Insert viewer to a JFrame to make it showable
            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.

+5
4

CSV ++ - , for ( ) - . . .

+1

"poi-3.10.1.jar" .

+1

Excel jxl. JasperReports , commons-beanutils commons-digester

0

, "poi-3.10.1.jar".

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.10.1</version>                        
    </dependency>
0

All Articles