Emre801
Emre801

Reputation: 3203

How do I add a second page in Jaspersoft iReport Designer 4.7

Hello I'm completely new to using Jaspersoft iReport Designer. I want to have a report with two pages. The version I'm using is 4.7.0. I already have one page with information on it but I have no clue how to add a second page. Any help will be appreciated. Thank you for your time.

Upvotes: 19

Views: 63628

Answers (6)

antnewbee
antnewbee

Reputation: 1949

On left side panel, right click on "add another detail band". After the detail band is created right click on the new detail band and click "Maximize band height"

Upvotes: 0

Reg.A.Khalil
Reg.A.Khalil

Reputation: 1

i use IReport 5.6.0 and you can add page by adding another detail section

Upvotes: 0

Harun ERGUL
Harun ERGUL

Reputation: 5942

Add a new detail band and put break page inside it.
This new detail content will be displayed in second page.

enter image description here

Upvotes: 3

Sharad
Sharad

Reputation: 3548

To add a new page go to Ireport and "Add Report Group" ,by adding report group you can add as many pages you want.

Upvotes: 2

Paris
Paris

Reputation: 367

I have found another way to add pages to a report (using iReport 5.0.1): You can just add a new detail region, set its height to be the same as the first and put the contents of the 2nd page in this new region. Actually you can add as many detail regions as needed thus creating a multipage report.

Upvotes: 7

Jacob Schoen
Jacob Schoen

Reputation: 14212

You can accomplish this a couple ways.

  • The first is actually creating 2 separate reports and merging them. Basically you draw out each page how you want it to look. On export, you create the 2 JasperPrint instances of the report, and then batch export them.

    public byte[] generateReport(JasperPrint jasperPrint1, JasperPrint jasperPrint2) {
      //throw the JasperPrint Objects in a list
      List<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>();
      jasperPrintList,add(jasperPrint1);
      jasperPrintList,add(jasperPrint2);
    
    
      ByteArrayOutputStream baos = new ByteArrayOutputStream();     
      JRPdfExporter exporter = new JRPdfExporter();     
      //Add the list as a Parameter
      exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST, jasperPrintList);
      //this will make a bookmark in the exported PDF for each of the reports
      exporter.setParameter(JRPdfExporterParameter.IS_CREATING_BATCH_MODE_BOOKMARKS, Boolean.TRUE);
      exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);       
      exporter.exportReport();      
      return baos.toByteArray();
    }
    
  • The second option is to go the Subreport route. Basically you create the first page of the report. Then you create the second page of the report. Then in iReport you can add the subreport in to Summary Band, passing any needed information that it needs to run (i.e Database Connection, datasource, parameters, etc.). Under the properties for the overall report you will want to make sure Summary on new page is selected so that the the subreport will print on its own page.

Upvotes: 26

Related Questions