I use the same data source for generating several reports. One of the reports needs to be printed with a few empty lines ("reserve") at the bottom, so that users can manually write missing data by hand if needed.
E.g.:
+---------+-------------+
| item 1 | bla bla |
+---------+-------------+
| item 2 | foo |
+---------+-------------+
| | | <--- here user can just add forgotten
+---------+-------------+ items with a pen
| | |
+---------+-------------+
The easiest for the JRXML would be if there were several records of null
s at the end of the data source. Then it would just print its "details" band a few times with no text, just as required. However, the data source is reused for other reports which certainly don't want this.
Can I somehow inject such empty lines into the data source in JRXML itself, just before report filling?
You can modify your CustomDataSource and set it from jrxml to generate extra records when needed:
Example
When you need extra empty records add this variable definition in your jrxml
I do not have custom datasource what can I do?
Normally without custom datasource, you can use the
columnFooter
with the attributeisFloatColumnFooter="true"
(or a dummy group footer band) to display extra info at the end of your detail band. Probably I would choose this method anyway since it helps to customize the extra rows and avoid checking fornull
in the normaldetail
bandIf you need dynamically to indicate the number of empty records, include a subreport with an empty record and pass as datasource JREmptyDataSource