[Table of Contents] [docx version]
WordprocessingML Reference Material - Table of Contents
Syntax:
STYLEREF field-argument [ switches ]
Description: Inserts the nearest piece of text prior to this field that is formatted by the style whose name is specified by text in field-argument. The style can be a paragraph style or a character style.
When this field is used in a header or footer, it results in the first or the last text formatted with the specified style on the current page, allowing for dictionary-style headers or footers.
The location at which a STYLEREF field is inserted determines the direction searched for the style, as follows:
• In document text, by default, the search goes backward from the STYLEREF field. If the style isn't found, the search goes forward from the STYLEREF field.
• In footnotes, annotations, and endnotes, the search goes backward from the footnote, annotation, or endnote reference mark. If the style isn't found, the search goes forward from the reference mark.
• In headers and footers in a printed document, the search is applied to the current page, by default, from top to bottom, for the specified style. If the style isn't found, the search goes from the top of the page to the beginning of the document, and then from the bottom of the page to the end of the document. If the \l switch is used, the search goes from the bottom of the page to the beginning and then to the end of the document.
• In headers and footers in an electronic document, the search goes on in the section that contains the STYLEREF field, from the beginning, for the specified style. If the style isn't found, the search goes from the end of the section to the end of the document.
Field Value: The nearest piece of text prior to this field that is formatted by the style whose name is specified by text in field-argument.
Switches: Zero or more of the following field-specific-switches.
\l |
Inserts the nearest text following the field. |
\n |
Inserts the paragraph number of the referenced paragraph exactly as it appears in the document. |
\p |
Inserts the relative position of the referenced paragraph as being "above" or "below". |
\r |
Inserts the paragraph number of the referenced paragraph exactly in relative context. |
\t |
When used with the \n, \r, or \w switch, causes non-delimiter and non-numerical text to be suppressed. |
\w |
Inserts the paragraph number of the referenced paragraph in full context, from anywhere in the document. |
[Example: When the following field is inserted in a header, it displays the contents of the first paragraph formatted with the style "Heading 3" on the current page:
On this page: { STYLEREF "Heading 3" }
To print the first and last names that appear on each page in a membership directory, for example, apply a character style called Last Name to each member's last name. Then insert the following fields in the header:
{ STYLEREF "Last Name" } — { STYLEREF "Last Name" \l }
end example]