Link to home
Start Free TrialLog in
Avatar of PraveenKumarGautam
PraveenKumarGautam

asked on

Jasper Reports (Sub Reports)

I'm using JasperReport, a requirement is the possibility to produce a multiple page report in which every page contains a different report.

Example:
Page 1 contains an actual invoice for a customer
Page 2 contains the invoices list for the customer
Page 3 contains a graph of amount of invoices by year
Page 4 contains only fixed text (say operator instructions ...)

Is it possible to create such a unique report instead of creating four standalone report and then merge the pdfs.

Please help me with some code example and some possible tutorials.

Thanks,
Praveen
Avatar of Mick Barry
Mick Barry
Flag of Australia image

try something like this:

List<Object> list = new ArrayList<Object>();
JRPdfExporter exp = new JRPdfExporter();
pageOne = JasperFillManager.fillReport(jasperReport, jasperParameter, con);
list.add(pageOne);
list.add(...
 
exp.setParameter(JRPdfExporterParameter.JASPER_PRINT_LIST, list);
exp.setParameter(JRPdfExporterParameter.OUTPUT_FILE, new File("test.pdf"));
exp.exportReport();
ASKER CERTIFIED SOLUTION
Avatar of Am P
Am P
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial