Specifying Headers and Footers


The Headers & Footers tab of the Page Setup dialog box allows you to create headers and footers, which are lines of text printed at the top and bottom of each page. You type in the header and footer text. You can use special content codes to insert worksheet-specific information like page numbers, the name of the workbook, the current date and time, etc. You can also use formatting codes to format and align the text.

To create headers and/or footers for the active worksheet:

  1. Select File > Page Setup and click the Headers & Footers tab, shown below.

  2. Enter text and formatting codes in the Header and Footer boxes. See below for information on special formatting codes.
  3. When you finish, click OK.

Formatting Codes for Headers and Footers

Formatting codes allow you to format and align the header and/or footer text and to insert worksheet-specific information.

There are three types of formatting codes: alignment codes, font codes, and worksheet codes. They must be entered in that order. If you put the codes in the wrong order, Formula One for Java may ignore some of them. Enter codes in upper or lower case and separate them with a space.

The following tables list the special formatting codes.

Alignment Codes Description
&L Left-aligns the characters that follow.
&C Centers the characters that follow.
&R Right-aligns the characters that follow.

By default, headers and footers are centered unless you use the &L or &R code.
Font Codes Description
&B Use a bold font.
&I Use an italic font.
&U Underline the text.
&S Strike out the text.
&"fontname" Use the specified font.
&nn Use the specified font size (must be a two-digit number)

Worksheet Codes Description
&D Prints the current date.
&T Prints the current time.
&F Prints the workbook name.
&A Prints the worksheet name.
&P Prints the page number.
&P+number Prints the page number plus number.
&P-number Prints the page number minus number.
&& Prints an ampersand.
&N Prints the total number of pages in the document.