Prabhath Karunakalage
Prabhath Karunakalage

Reputation: 67

Add multiple pages to report

How to add multiple pages to JR report with the same layout and different content?

I am trying to print payslips for employees. So instead of printing each pay slip for an employee I want to print all of them together in one jasper report. one payslip per page with multiple pages according to the number of employees.

Upvotes: 0

Views: 1189

Answers (1)

Mechkov
Mechkov

Reputation: 4324

Populate your data in a List or Map. Then, use the appropriate JRDataSource - JRMapDataSource or JRBeanDataSource and pass it to the JReport exporter - PDF, XLS, whatever. You can even populate a table with your datasource and will print each row as a separate payslips (if you have populated your data correctly).

In a nutshell, populate your data in a collection and then iterate through the collection in your JasperReport Detail Band.

I would highly recommend using iReport Designer tool for JasperReports.

Good Luck!

Upvotes: 1

Related Questions