Learn how to a build a cloud-first strategyRegister Now


Jasper Reports (Sub Reports)

Posted on 2011-05-03
Medium Priority
Last Modified: 2012-05-11
I'm using JasperReport, a requirement is the possibility to produce a multiple page report in which every page contains a different report.

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.

Question by:PraveenKumarGautam
LVL 92

Expert Comment

ID: 35517245
try something like this:

List<Object> list = new ArrayList<Object>();
JRPdfExporter exp = new JRPdfExporter();
pageOne = JasperFillManager.fillReport(jasperReport, jasperParameter, con);
exp.setParameter(JRPdfExporterParameter.JASPER_PRINT_LIST, list);
exp.setParameter(JRPdfExporterParameter.OUTPUT_FILE, new File("test.pdf"));
LVL 21

Accepted Solution

Amitkumar P earned 2000 total points
ID: 35672534

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month20 days, 22 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question