STYLEREF Fields and Language-specific Style Names
STYLEREF fields are often used to repeat e.g. document headings in the document header. This is a great feature.
A STYLEREF field must refer to the name of a specific style. If your templates or documents are to be used on computers with different language versions of Word, you cannot simply refer to the name of a built-in style in a STYLEREF field since the style name will be different in another language version of Word. For example, the English style name "Heading 1" is "Overskrift 1" in a Danish version of Word. A STYLEREF field that refers to "Heading 1" will show an error code in non-English versions of Word.
This article provides tips on how you can overcome this problem and create STYLEREF fields that will work correctly in any language version of Word.
The field code of a STYLEREF field
The syntax of the field code in a STYLEREF field is:
If, for example, you want to repeat Heading 1 in the header, the field code could look like this:
How to prevent problems with STYLEREF fields
STYLEREF fields to built-in heading styles - how to prevent problems across different language versions of Word
The STYLEREF field code above for "Heading 1" is OK if the document in question is used on a PC with an English language version of Word installed. But if you open the same document on a PC with another language version of Word, a problem occurs since "Heading 1" is no longer a correct style name. The style name is not found and the field will show an error, telling that the style does not exist.
In case of the heading styles, Heading 1, Heading 2, ... , Heading 9, you can prevent the problem by using only the heading level number instead of the full name:
The field code above will work in any language version. But you do not have the same option when it comes to other built-in styles. You will need to use the correct style names. See below for a way to work around that problem.
STYLEREF fields to other built-in styles - how to prevent problems across different language versions of Word
Example
You want to use a STYLEREF field to repeat the title of a document. You have used the built-in style, "Title" for the title text. But in e.g. a Danish version of Word, that style is named "Titel".
Therefore, the field code { STYLEREF "Title" } will not work since "Title" is not the correct style name in other languages. Only the built-in heading styles have a number you can use instead of the full style name.
If you create a STYLEREF field using the English name "Title", { STYLEREF "Title" }, and open the document on a computer with a Danish version of Word, you will see error code (1) below. If you use the Danish style name in the STYLEREF field and open the document on a computer with an English version of Word, you will see error code (2) below.
Styles and alias names
The solution to the problem illustrated in the example above is to take advantage of alias names to styles.
Any style in Word, built-in or custom, can be given one or more alias names, i.e. extra names that can be used together with or instead of the "main" name. The "main" name and alias name(s) must be separated by the list separator specified in Regional and Language > Additional settings. In US the default list separator is a semicolon, in e.g. Denmark the default list separator it is a comma.
Note that all style names in a document must be unique. This is true for alias style names too.
Now the trick: You can add an alias name to the built-in style name (in this example the style "Title"). You do so by specifying the alias name at the end of the existing name in the Modify Style dialog box, separating it from the existing name with the correct list separator.
In the illustration below, the style "Title" has been given an alias name "MyTitle". A semicolon separates the names:
To insert a STYLEREF field to the built-in style "Title", you can now use the alias name in the field code:
It is important that the STYLEREF field refers to the alias name only.
Since the alias name is a custom name, it is a fixed name that will not change. This way that STYLEREF field will work correctly regardless of the language version of Word.
What you should also know about alias names to styles
A disadvantage of alias names is that they follow along if you copy text to another document and paste the text in a way that preserves styles. This way, you may end messing up style names in other documents.
You can assign keyboard shortcuts to styles. Short alias names can also be used as shortcuts for selecting styles. An alias name can consist of a single character only. For example, you could add "p" as an alias name for a style that is used very often and the style can be applied by pressing Ctrl+Shift+S to open or activate the Apply Styles window, then type p, then press Enter.
Related information
Via the link below, you can download a PDF document that contains the style names of almost 140 built-in styles in English, Danish, German and French:
Word Style Names in English, Danish, German, French
See also the article Create List of Local Built-in Style Names
For more tips about STYLEREF fields, see also Useful StyleRef tricks.
Did you know that...
DocTools Word Add-Ins
can help you save time in Word
On my website wordaddins.com you will find some of the Word Add-Ins I have developed, ready for use:
Generate complete documents in seconds from re-usable text or graphics - read more...
helps you manage comments in Word fast and easy – review comments, extract comments, etc. - read more...
Makes it easier than ever to work with cross-references in Word documents - read more...
Lets you manage document data efficiently with custom document properties and DocProperty fields - read more...
Lets you extract insertions, deletions and comments in full context and including headings - read more..
Lets you apply or remove any highlight color by the click of a button - read more...
Browse pages, headings, tables, graphic, etc. and find text in Word with a single click - read more...
Browse pages, headings, tables, graphic, etc. and find text in Word with a single click - read more...
Lets you quickly and easily create screen tips in Word with up to 2040 characters - read more...