JasperReport: Purpose of the Details Band

后端 未结 5 1448
南旧
南旧 2020-12-30 12:05

I figured this would be something that would be fairly-well documented as its a central theme to JasperReports, however I can\'t find an answer for this anywhere.

5条回答
  •  悲哀的现实
    2020-12-30 12:52

    The information you have is correct, you've just had a slight misunderstanding of what it means.

    The 1:1 relationship is at fill-time; Once the report has been filled there will be exactly 1 detail band for every record in the dataset. When you are designing the report you only add the band once, but that one band is repeated over and over again when the report is filled.

    You can add as many detail bands as you wish. Each of the bands have a 1:1 relationship with the dataset records, and all of the detail bands are filled before moving on to the next record (i.e. If you have three bands A, B, and C; Their order in the report will be ABCABC... not AAA...BBB...CCC...).

    • It is possible to add bands programmatically, but the important point to note is that you are adding bands to the report design, not to the completed report. So just as with a jrxml design, you add the band once and it gets repeated for each record. Check this example.

    • There isn't a relationship between report pages and detail bands. The report filler will try to put as much onto a page as possible while respecting the splitType of each band as well as other report properties.

    • Is passing a null datasource is allowed? In any case the 1:1 relationship is still valid: A dataset with 0 records produces 0 detail bands in the report.

提交回复
热议问题