Software

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.

About

Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.

4 comments
mhudnall
mhudnall

I have used StyleRef in Headers for several years to refer to first-level and second-level headings. This information in the Header helps readers see at a glance the context for what they are reading, especially if the document is long and uses many heading levels.

lkopp123
lkopp123

Excellent tip--have never thought of that before! Here is a suggestion to keep the text in table format, have a repeating header row, AND get the desired results: 1. Add a header row for the table and label columns as needed 2. Repeat header row: - Click in table, select the header row, select Layout tab, go to Data group, select Repeat Header Rows 3. Format entire table: - click in table, click selection box in upper left, format as desired staying with the Normal style or use a built-in or custom style 4. Format 1st column only: - select the 1st column, apply a style. You can use one of the built-ins or create a custom one for the first column only. If you used a style to format the entire table, just don't use the same one! Modify the style to match the formatting of the rest of the table, or format it differently form emphasis. 5. Open the header/footer area using the instructions above. 6. Insert the StyleRef field code using the instructions above with one exception: select the name of the style that you used to format the 1st column. Beginning to see where we are going? 7. You will notice that the StyleRef code picks up the 1st column header--that's because you selected the ENTIRE 1st column and applied the 1st column style. Easy to fix. Close the header/footer area. 8. Select the header row and apply the style that you used to format all of the table EXCEPT the 1st column. The StyleRef code now picks up the first item that has the 1st column style applied to it. Seems like a bunch of additional steps, but it is worth the extra effort. Hope this helps!

RobD.
RobD.

This is a useful tip, but I cannot read the fine print in the screenshots.

Hoosier Girl
Hoosier Girl

this is a very slick tip. And so simple.

Editor's Picks