Many corporate documents require you to have a table near the beginning of the document with details such as the author, the date created, a revision number etc. You may also be required to insert some of these details into the header and/or footer of the Word document. While you can set up all sorts of macros, cross-references, document property fields etc. To do this, here’s a really quick solution using styles and the StyleRef field. This solution works in Word 2003, Word 2007 and Word 2010 at least. Before attempting this, you should know how to create a new style in your version of Word. Note: The StyleRef field will NOT ‘see’ any styles used in text boxes (see the comment from November 2017 below).
Nov 13, 2018 - You are invited to take part in a short survey to help us improve your Apple Support. Add headers and footers in a word-processing document.
Create new styles for the text elements you want to capture. Give these styles names that are unique and are unlikely to be used anywhere else in the document (this is critical). For example, DocAuthor, DocDate, DocTitle, DocRevNum. Don’t worry about formatting — the header/footer styles will control that.
Apply the new styles to the relevant cells. Open the header or footer ( Word 2003: View Header and Footer; Word 2007/2010: Insert Header Blank then remove the control OR double-click in the header space to open the header).
Insert a StyleRef field for each of the elements you want to populate. To insert a field: Word 2003: Insert Field; Word 2007/2010: Insert Quick Parts Field. Select StyleRef from the list of field names on the left (1), then select the style (e.g.
DocAuthor) from the list of style names on the right (2), and click OK (3). This works very well.
But my problem is that I am using a Date Picker Content control in Word 2007 on the Title page to standardize the special date formatting, and I need to have that same date in my header. I used the StyleRef trick and it’s fabulous, but the date is now surrounded. How can these be removed? I have tried using a bookmark and cross-reference, which works well in the body of the text, but not in the header since it does not allow me to have have one font style on the title page, and a different font style in the header. Marguerite October 7, 2009 at 6:51 am.
I am editing a manual with about 600 pages and 23 Sections, labeled A through V. I often do changes to several of the pages, which changes the revision number on the those pages. Section A contains a section called “List of Effective Pages.” The List of Effective Pages contains a three column multi row table containing three pieces of data from each page in the document: the page number, the revision number, and the effective date. Is there a way, after I change some of the pages, that each of these pieces of data, which are contained in the header and/or footer, be automatically updated like in a Table of Contents and imported into the table in Section A? Dan Koko November 13, 2011 at 11:45 am.
I have the issue with Track Changes used in the referenced style not showing in the Header with the StyleRef field. The text appears but, in this case, is not strikethrough. So my setup is the “Date” style at the top of the letter. With Track Changes on the date is changed on page one and shows the new date and the strikethrough on the old date.
In the Header on page two it shows both dates but no strikethrough. Any ideas on how to get this formatting to show in the field? Alan May 2, 2013 at 2:32 am.
Hi Alan I just tried it and I get the same thing as you, except I get both dates in ALL places (none except the original source date field have track changes marked for them). I checked the field code, and there’s just one for the ‘combined’ date so it’s not like it’s showing two fields. I don’t have a solution for you, except to suggest you accept the change for this field if you are able to do so. However, corporate requirements may mean you have to leave it on until the changes have been ratified, in which case I’d let the next set of reviewers know about this anomaly and tell them to ignore it. –Rhonda May 2, 2013 at 8:28 am. I have used STYLEREF many times with no problem, but right now I got an error, stating that there is no text in the document with the requested style (or whatever the English equivalent may be). What I tried to do was actually the opposite: I had the text that formed the name of the project, formatted with a style called “Project”, but I had that text piece in the header, and tried to populate the footer with it.
It didn’t work. Is there a problem referring to styles that are contained in a Header/Footer? Thanks Bengt Bengt Eriksson May 23, 2014 at 6:41 pm. Hi Rhonda, Thanks for your answer. Yes, I guess it is a fair question to ask, why you would repeat in the footer if it is in the header. However, this is what my job situation required me to do, and since this doesn’t seem to be possible to do, I guess my only option is to put the text somewhere in the document text. By doing so, I can obvously refer to if both in the header and the footer.
![Word Word](/uploads/1/2/5/5/125511601/326830469.png)
Strange limitation though. As I said, I have been using Styleref a lot, but clearly, not in this fashion. Bengt Bengt Eriksson May 25, 2014 at 5:15 am. Hi Karen The actual styles should only ever be used once in the document — that means a single use of one of these special styles in ONE paragraph or ONE cell of a table (see Step 3 above). Assuming that’s the case, then you should be able to insert styleref fields that refer to one or more of those special styles in the same paragraph (see Steps 5 and 6). Something might be getting messed up when you insert the tab — have you tried toggling field codes on to make sure you are entering the tab AFTER the field code curly braces? (You can show all field codes temporarily by setting this in the Options — for Word 2010, File Options Advanced Show Document Content section Show field codes instead of their values check box — don’t forget to turn it off when you’re finished) –Rhonda August 13, 2014 at 6:13 am.
I have set up a few templates for my office that use this technique. There is one issue that I cannot find the answer to: The table (step 2) is a 3-column layout.
In the cell that the StyleRef is pulling information from, the entered info often gets pushed to a second line within the cell. Example: City of Oceanside Department of Recreation Users, in an attempt to control how those two lines are split, will hit ‘Return/Enter.’ Example: City of Oceanside‘Return/Enter’ Department of Recreation When they do this, only the second line of the entered info gets displayed in the footer even though both lines within the table are the correct referenced style. Ideally, the two lines would appear in the footer on the same line. I doubt that I can get users to stop pressing ‘Return/Enter’ when filling in this information and was wondering if anyone has a hint/solution/macro that could help? This might be a stretch but do you know if there is a way to set a macro for the StyleRef that eliminates the ‘Return/Enter’ line jump before populating the footer? Elyssa March 30, 2016 at 12:40 am. Thanks for the response, Rhonda.
That does work – all the information is translated to the footer (now as a two-line footer.) But I’m hoping that there is some way that I, as the administrator of these templates, can take the solution out of the user’s hands. As much as I hope people would use Word properly and learn the tricks, I doubt they will. If I could program the StyleRef (or maybe a macro?) to automatically do the soft break, that would be ideal. Any hints/tips are greatly appreciated.
Elyssa March 30, 2016 at 11:58 pm. I have also encountered an issue here. I am trying out the ‘styleref’ field in a company template and am trying to understand how it works.
The reference doesn’t always update on every footer – sometimes it will update on page 3, but not page 1 and 2. Then sometimes page 1 will suddenly update whilst navigating the document – but not page 2. There seems to be no consistency either in when it happens, it is random. It will however update on ‘print preview’ but i’d like to know why it isn’t updating in the first place.
I have no ‘section breaks’, ‘link to previous’ or ‘different first page’ set. Any advice would be appreciated. June 24, 2016 at 11:53 pm. Hi Peter My personal opinion of text boxes in Word is that they are the spawn of the devil, and I avoid them wherever possible! I just did a quick test by adding a text box to an empty Word doc, styling it with one of the default styles (‘Subtitle’ in this case), then adding a table and trying to insert a StyleRef field to ‘Subtitle’ into a table cell.
I got the same result as you — a style used in a text box is NOT listed in the available styles for the StyleRef field. I repeated the test, but this time with text outside a text box, styled with Heading 2.
It was the only Heading 2 style used in my test doc. When I tried to insert the StyleRef field into the table cell, Heading 2 WAS listed as an available style, as I expected. So, it looks like Word ignores any styles in text boxes for the purpose of the StyleRef field. Good pickup on your part, but a pain if you wanted to use it! Instead of using a text box, can you use a borderless table instead to emulate the layout you want? –Rhonda November 24, 2017 at 12:31 pm.