Jump to content
JasperReports Library 7.0 is now available ×

Ejecute compiled jasper since java jaspersoft library


juanfernet007

Recommended Posts

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

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

...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 + regards

C-Box

Link to comment
Share on other sites

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.html

e.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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...