Add headers and footers to a report

To add a page header or footer to a report, create a simple container and set the Section property.

About this task

Placement of the header and footer containers take the page size into account. When a report page is printed, any page header prints at the top of the page, followed by the content of the containers associated with trigger nodes, followed by any page footer at the bottom of page, in accordance with the Page Size set for the report. This is the basic design of the report page, which is repeated when the report is run for as many pages as are required, based on the data passed to the Report Writer.

  1. Open or create a report.
  2. Add the header or footer container to a Mini Page or Page Root of the report.
    You can use any simple container or drawable, but a Vertical Box (Layout Node) is most commonly used.
  3. Set the container's Section (also called port) property to one of the header or footer values.
    For example, a Vertical Box with the Section property set to the firstPageHeader section will print as the header on the first page of the report. For a full list of the options, see Section. In the parent container, you cannot have multiple header or footer containers set to the same section.
  4. If you use a Vertical Box for the header or footer container, set the Layout Node's X-Size property to max, and its Y-Size property to min.
  5. Ensure that the header and footer nodes are correctly placed in the Report Structure.
    Important:

    If the Section property is specified, the header or footer must be the elder sibling of any node without the Section property specified. The exception is the Last Page Footer, which must come after the other nodes. See Figure 1.

    Figure: Headers and Footers in Structure View

    The figure shows the OrderReport.4rp report in the Structure View. All headers and footers are included before other content, except the last page footer, which is at the end of the structure.
  6. Build up the header or footer using various containers and report elements.
    For example:
    • Stripes are useful for report elements that are to be laid out left to right across the page.
    • Word Boxes and Image Boxes display content within the container in the order in which it should be printed.
    • Page Number Boxes provide runtime information about the pages of the report.
At most, one header and one footer displays in the Design view at any one time. You can choose which header or footer to display using the combobox, as in Figure 2.
Figure: Select header to display

Drawing shows how to select the header to display in the Design view

Example

See the OrderReport.4rp report in the Reports demo application.