juanfernet007 Posted May 6, 2019 Share Posted May 6, 2019 I need execute a compiled jasper with jaspersoft library. I don´t want to compile the jrxml file. I only need to execute a jasper file. I suppose that the compiled file already has the connection and I only have to send the parameters to it.I need export into Excel. Thanks. Link to comment Share on other sites More sharing options...
C-Box Posted May 7, 2019 Share Posted May 7, 2019 ...so just use the fill Method (e.g. the JasperFillManager should provide several functions for that purpose when I remember right) and pass the precompiled .jasper file + the connection + the parameters map.The connection isn't stored within the compiled jasper object. Afterwards you can use the JRXlsExporter to export the generated jrprint to an excel file.Hth + regardsC-Box Link to comment Share on other sites More sharing options...
hozawa Posted May 7, 2019 Share Posted May 7, 2019 Use JRLoader to load the .jasper file. SQL statement is defined in the jasper file but you'll still need to define the data connection and fill the report using that connection.http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/util/JRLoader.htmle.g.JasperReport jasperReport = (JasperReport) JRLoader.loadObject(path_to_jasper_file);JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, param, datasource);JRXlsxExporter exporter = new JRXlsxExporter();exporter.setExporterInput(new SimpleExporterInput(jasperPrint));exporter.setExporterOutput(new SimpleOutputStreamExporterOutput( new File(output_filename)));exporter.exportReport();[/code] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now