Adding a Header and Footer
A report can contain a header and footer that run along the top and bottom of each page, respectively. Headers and footers can contain text, images, and other report items, but they cannot contain data regions, subreports, or an item that refers directly to a field.
In Report Designer, page headers and footers are displayed on the first and last page of a report by default. You can suppress page headers and footers on the first and last page of the report. To change this setting, change the PrintOnFirstPage or PrintOnLastPage property for the header or footer.
Report headers and footers are not the same as the headers and footers in a table. For information about table headers and footers, see Adding a Table.
To view instructions about working with headers and footers, click a topic in the following list:
- How to add or remove a page header or footer (Report Designer)
- How to hide a page header or footer on the first or last page (Report Designer)
Displaying Data in a Page Header or Footer
Page headers and footers can contain static content, but they are more commonly used to display varying content like page numbers or information about the contents of a page.
You cannot refer directly to a field in a text box in a page header or footer. (For example, you cannot use the expression =Fields!LastName.Value.) To display field information in a page header or footer, place the field expression in a text box in the body of the report, and then refer to that text box in the page header or footer. The following expression displays the contents of the first instance of the LastName text box on the page:
=First(ReportItems!LastName.Value)
You cannot use aggregate functions on report items in the report body. You can only use an aggregate function on a report item (like the First() function described previously) in a page header or footer.
For common expressions in page headers and footers, see Common Expressions.
Adding a Page Number to a Footer
One of the more common uses for a footer is to display a page number. To display a page number in the footer of a report, create a text box in the footer and add the following expression:
="Page " & Globals.PageNumber
For more information about expressions, see Using Expressions.
Adding a Report Border
You can add a border to a report by adding borders to the headers, footers, and report body. In the header, add a left, top, and right border. In the body, add a left and right border. In the footer, add a left, bottom, and right border. If you do not use headers in your report, you can place borders around just the report body.
If you add a report border that appears on the page header and footer, do not suppress the header and footer on the first and last pages of the report. If you do, the border may appear cut off at the top or bottom of the first and last pages of the report.