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.
Populate your data in a List or Map. Then, use the appropriate
JRDataSource - JRMapDataSource or JRBeanDataSourceand pass it to theJReport 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
iReportDesigner tool forJasperReports.Good Luck!