Add a dictionary-style header to your Word document

Use the StyleRef field in Microsoft Word to display a dictionary-style header (or footer) in your Word documents.

Documents that consist of long listings often benefit from adding a dictionary-style header. By dictionary-style, I mean a header at the top of each page that displays the first and perhaps the last item on each page. It sounds like something that requires a lot of specialized knowledge, but using Word's StyleRef field, it's quite easy. For example, the following is the first page of a 21 page listing of wildflowers in table format.

To add a dictionary-style header that displays the first item on each page, do the following:

  1. Open the header. In Word 2007 and 2010, just double-click in the header area. In Word 2003, choose Header and Footer from the View menu.
  2. Click the Insert tab, and choose Field from the Quick Parts dropdown in the Text group. In Word 2003, choose Field from the Insert menu.
  3. Choose StyleRef from the Field Names list. Select Normal (or the style in use for your listing) from the Style Name list.
  4. Click OK.

This particular field inserts text that's formatted with the specified style—in the case of this example, that's Normal. More specifically, this field retrieves the first data it finds using the Normal style, up to the end-of-row marker (more about that later).

Adding a field that displays the last item in the page, for this particular document, is problematic. Let's try it and see what happens. Open the footer and follow the above steps. Before clicking OK, click the Search From Bottom Of Page To Top option so the field will find the last item using Normal style on the current page. If the items are in a table that extends multiple pages, as in the example document, this field appears not to work. The problem is the end of row marker at the end of each page row. A manual page break will have the same effect.

The easy way to resolve the problem is to convert the table to text. In Word 2007 and 2010, select the table. Then, click the Layout tab and choose Convert To Text in the Data group. Choose Tabs (or the appropriate delimiter) and click OK. In Word 2003, choose Convert from the Table menu and then select Table To Text.

Once you remove the table (and the end of row markers) both fields display as expected—almost. It's true, converting the table to text does allow the footer field to display the last item on the page. However, both fields will display the entire row instead of the contents of a single cell, as the header field originally did. It isn't a perfect solution, but if you can live with the results, it's certainly an easy solution.