Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create JasperReport object from compiled .jasper file?

I have compiled report (.jasper file). I need to get some info from that object (for example report name). How to do that ? If I could create JasperReport object, i can call getName() method on it, but I don't know how.

like image 993
marioosh Avatar asked Mar 28 '12 12:03

marioosh


People also ask

How do I compile a Jrxml file?

Expand this group, find your . jrxml report and rightclick on it. In context menu choose 'Compile report'. Then you get compiled .

How do I create a .jasper file?

In Jaspersoft Studio select the menu item Project->Build Automatically. Now Studio will create the . jasper file in the same location as the . jrxml file.


1 Answers

You can get the JasperReport object by doing:

JasperReport jasperReport = (JasperReport)JRLoader.loadObject(new File("filename.jasper"));

from there you can get the name by doing:

jasperReport.getName()
like image 90
Jacob Schoen Avatar answered Oct 21 '22 21:10

Jacob Schoen