Subreport JasperReport
I need to develop a report in Jasper-Report which contains a lot of sub-reports. I 'll give you an example what I need:
Master Report: - Title - Subreport (1) - Footer
Subreport (1)
- Table_1 (One time)
- Table_2 (Could be repeated a lot of time)
- Table_3 (One time)
I need to repeat the Table_2 and Subreport(1) a lot of time, and I don't to know how can I done. I hope had explained clea开发者_如何学Pythonr. Thanks
- Make three Detail Bands in Subreport (1).
- Create three new subreports: Subreport_Table_1, Subreport_Table_2, Subreport_Table_3.
- Put Subreport_Table_1 in Detail Band 1; put Table 1 in Subreport_Table_1.
- Put Subreport_Table_2 in Detail Band 2; put Table 2 in Subreport_Table_2.
- Put Subreport_Table_3 in Detail Band 3; put Table 3 in Subreport_Table_3.
This results in:
Master Report
Subreport (1)
Detail Band 1 - Subreport Table 1
Table 1
Detail Band 2 - Subreport Table 2
Table 2
Detail Band 3 - Subreport Table 3
Table 3
Now you can control the number of times Table 2 is printed independently of Table 1 and Table 3.
Nicopuri this is the answer for your comment
For printing subreport more than once your main report's sql query should return more than one row. Then put your subreport in a detail band in your main report.
For example lets say your query result is like below
| id | name |
| 1 | bla |
| 2 | bla2 |
think main report as a loop which is looping 2 times. and detail band as the inside of that loop. so detail band will be evaluated 2 times.
精彩评论