Add a Last Page Footer to your report
Genero Report Writer video scripts
Related video: Add a Last Page Footer to your report
Description: Create a report in Genero Report Designer that uses a unique footer for the last page of the report.
Tags: Genero Report Writer, footer, last page
Presentation |
Script |
Intro splash |
|
Slide |
In this presentation, you will learn how to create a footer that only appears on the last page of the report, replacing the standard footer. |
Slide |
The Section property has values for FirstPageHeader or FirstPageFooter. What if you want to print a LastPageHeader or LastPageFooter? Last page headers and footers are useful for Invoice or Statement reports, where the total displays in the same place on the last page or on a tear-off slip to return with the payment.
The LastPageHeader and LastPageFooter been added to the requested features list – you can track it by entering 11892 in the Issue Tracker. Until they are implemented, a work-around allows you to create your own.
In this presentation, you will learn how to add a LastPageFooter.
On the page itself, check the Hide Page Footer on Last Page check box.
Add a “Last page footer” container to the very end of the report structure. It is a LayoutNode without the Section property set.
Place this “Last Page Footer” container at the bottom of the page. To do this, edit the properties Anchor Y and Y.
Set Anchor Y equal to 1. Set Y to max.
Next, insert a spacer – a LayoutNode – into the Report Structure above your Last Page Footer container. This spacer reserves space according to the height of the footer:
The Last Page Footer is “self placing” (it has Y set) and “self placed” items are not taken into account when computing space requirements in the parent, as they can float on top of the other items.
Some space is already allocated by the regular footer; the “spacer” allocates the rest ( the difference between the Last Page Footer and the regular footer) .
If the height of your Last Page Footer container is bigger than the height of the AnyPageFooter, then the height of the spacer should be the difference between the height of the Last Page Footer container and the height of the AnyPageFooter container.
If the height of the Last Page Footer is smaller than the height of the AnyPageFooter, then the height of the spacer should be zero.
Follow this demo to see why this solution works. |
Demo: Show simple list report with any page footer in yellow |
Here is a simple list report. You can create your own list report, or use any report to which you need to add the Last Page Footer.
Notice that the background color for the AnyPageFooter container is set to yellow, so that you can quickly see the footer on your report pages. |
Run report and view results |
Run the list report. It outputs four pages. Each has the footer. |
Alter report: Select hide last page footer check box. |
First, hide the footer on the last page. |
Run report and view results |
Run the report, and notice that the last page has no footer. |
Alter report: Add last page footer container, set Anchor Y = 1, Y = max, y-size = 30, x-size = max. Background color green |
Add a Last Page Footer container to the report. To add the container, select the Page Root and – from the Tool Box – add a Vertical Box Layout Node by double-clicking on the object name.
Set the relevant properties:
Name the container Last Page Footer. Set Anchor Y to 1 Y to max X-size to max Y-size to 30 And, so that you can easily view the container on the report, make the background color green.
In a real report,you would add data fields, totals, or Tool Box items to the footer. Any information you need in the footer. |
Run report and view results |
Run the report again, and see that the last page now has your Last Page Footer container. So far, so good! |
Alter report: Change y-size to 80. |
You have not yet put in the spacer element.
Change the height of the Last Page Footer container from 30 to 80. |
Run report and view results |
Save your changes and run the report.
Look at the last page.
You still have the Last Page Footer container, but this time, because of its increased height, it is laying OVER the top of the report data.
The Last Page Footer container is at the size and location you specified, on top of some of the report data.
You need to include a spacer. |
Alter report: Add spacer. |
Return to the report and add a spacer, which is another Vertical Box Layout Node.
Move this spacer ABOVE the Last Page Footer container.
Set the height of this spacer equal to the difference in the heights of the ANyPageFooter and Last Page Footer – for this report, the difference is 50.
TO see where this spacer is put, change the X-size to MAX and set the background color to PURPLE. |
Run report and view results |
Save the report once more, and take a look at the report.
The last page footer no longer overlays the report data. It has been pushed to a new last page, where it sits alone. |
Alter report: |
If there wasn’t an overlay issue, the Last Page Footer would still be on the same last page as the data. To illustrate this, change the font size of the table row data to 12
Save the changes and run the report. |
Run report and view results |
See that both the spacer and the Last Page Footer are on the same last page. The spacer is overlayed by the Last Page Footer, but that is not an issue. It is only a spacer. |
Slide |
To recap: The process is outlined on this slide.
The last point states that when your Last Page Footer height is less than the AnyPageFooter height, your spacer height should be set to zero. You do not really need a spacer, but by adding the spacer of zero, if you ever change the Last Page Footer height, you can modify the spacer height to prevent an overlay. |
Outro |
This concludes the presentation and demonstration. Be sure to check out the other Genero Report Writer videos. |