Dynamic headers

Word's STYLEREF field lets you display text from a document formatted with a named style in the header or footer. To illustrate, say you want chapter titles to appear in the header of each page. Assuming your chapter titles are formatted as Heading 1, go to View | Header And Footer and press [Ctrl][F9] to insert field braces. Type STYLEREF, followed by a space, and then enter the named style enclosed by quotation marks. Your field should look like this:

{STYLEREF "Heading 1"}.

When you print or print-preview, the STYLEREF field will scan your document and display the first text it finds that carries the style specified; that text will then be displayed in the header or footer. If the STYLEREF field doesn't find any text formatted with the specified style, it will display an error message. However, if a style was specified for the previous page, STYLEREF will scan the current page and display matches for the previous style.

The STYLEREF field will scan your document somewhat differently depending on where it's inserted. When it's placed in a header or footer, by default, STYLEREF will scan the current page from top to bottom. If it doesn't find the specified text on the current page, it will scan from the bottom of the preceding page to the beginning of the document. If it still doesn't find the text, it will begin at the top of the page following the current one and scan to the end of the document.

Created Date: 05/03/2002  Last Reviewed: 05/03/2001  Rev. Date: