The current output:
(Footer)
2 Answers:
Hi,
This could be done by using the print when expression for tghe page header band as $V{PAGE_NUMBER} == 1
This will solve the purpose for the page header
For the page footer for the last page you can simply use the band name LAST PAGE FOOTER
Hope that this helps
Thanks,
Ankur Gupta
Hi,
If you are following the way I described it will work fine for csv .
Now if you want to vary the layout of header and footers then you could simply add a parameter suppose $P{OUTPUT_FORMAT} which takes user input to decide the layout the choices which user could enter would be "CSV","PDF","XLS" .. etc. according to you needs.
Suppose you have that parameter $P{OUTPUT_FORMAT} -I am here explaning in "CSV" and "PDF"
CASE 1:
When user enters CSV
The print when expression for report header would be $P{OUTPUT_FORMAT} == "CSV" && $V{PAGE_NUMBER}==1
Now this will give you the header for the report only on the first page in the case of CSV Format
CASE 2:
When user enters PDF
The print when expression for report header would e $P{OUTPUT_FORMAT} == "PDF"
Now to provide dynamism you can combine the PrintWhenExpressions like
$P{OUTPUT_FORMAT} == "PDF" || ($P{OUTPUT_FORMAT} == "CSV" && $V{PAGE_NUMBER}==1)
Now here I have combined for PDF and CSV but you can do this in any other format
I have depicted the same in a sample JRXML it uses the sample database.And also attaching the CSV and PDF Exports.
Hope that it helps.
Thanks,
Ankur Gupta
Attachment | Size |
---|---|
![]() | 7.12 KB |
![]() | 7.61 KB |
![]() | 3.57 KB |
When I export to xls, it works, but not to CSV
I still want the headers there when viewed as PDF, so they should just be hidden when exporting to CSV
(I know this has to be possible because it works like this for my "export to xls")