Jasper Reports (Sub Reports)

Posted on 2011-05-03
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

    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 20

    Accepted Solution


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    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 tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now