Word changing font on Field text with Cross References

I am trying to get WORD to work for me and not against me and everyone knows what a fun time that is. I am trying to use the Field text with bookmarks and cross references to have the word document auto update the client name throughout my client's contract. The name appears in about 10 locations and I just want it to auto fill this data.

It's working but not quite. The cover page uses a font size of 18, but I don't want the client name to be in a font size of 18 in the other areas of the document. I select the cross reference areas and select a font size of 11.

Now here is the fun part. After I lock the page and then edit that field, if the clients name is only one word, it does it fine and preserves the font size and face in the other sections of the word document. (ie it puts the clients name at size 11 and not size 18 thorughout my document). But wait, if I put two words or more, so there are spaces, then the first word in the cross reference stays at size 11 but all following words are at a size of 18 like the original text on the cover page)

This has to be a bug in microsofts product, but does anyone know a way around this?

Who is Participating?
harfangConnect With a Mentor Commented:
Place the cursor in your reference, and press Shift+F9: this reveals the actual field code. Then add or change the formatting switch to "merge format" or "character format", like this:

    { REF client_name \*CharFormat }

Press Shift+F9 and F9; the client name will now have the exact formatting of the letter R of the 'REF' keyword, instead of the original formatting from the bookmark.

See also: Format (\*) field switch

Another solution would be to store the client name elsewhere, for example in the document properties. These do not have formatting, so you would not encounter the problem at all.

That is strange.  Unfortunately, I am unable to duplicate your problem.

Could you attach a sample file?  Just remove the text between the cover page and the cross-reference.  

Also, which version of Word are you using?
Eric FletcherCommented:
No, it isn't a bug -- but it does catch a lot of people.

I predict that your bookmarked target has been formatted with direct formatting instead of with styles. The REF field will "inherit" the direct formatting, although you can manage it to some extent by using the \* MERGEFORMAT switch AND specifically setting the format to what you want.

If you use styles, the target format (for the REF field) will use the 'default paragraph font' part of the style from the source -- and will then match the font used for the field.

You can easily test the various behaviors by bookmarking content in both a style-managed paragraph and a Normal styled paragraph that has been directly formatted to match the one set with styles (i.e. say a Heading 1 style with the default 18pt Arial bold, and a Normal style with the same font set by the Font dialog), then create the REF cross references.

If you use the default settings, you will see the differences. Select the field that has the inherited font you don't want used and press Ctrl-Spacebar to reset the font. Now alter both instances of the bookmarked content by adding a word or two and then recalculate the fields (F9). The results will be set in the font you want for the styled paragraph -- exactly as it should be -- but the directly-formatted source will include the bold you didn't want. You will need to repeat the modification to the format for the field code to fix it. Use Alt-F9 to toggle between the field codes and the results so you can see the field switches in effect.

As I noted in the start, this is not a bug, and is quite consistent with how Word was designed to work. The problem comes up because the vast majority of people are not using Word the way it was designed. On the surface, a document formatted with the Normal style and direct formatting can look identical to one managed exclusively with styles -- but the former will have lots of "gotchas" like this, and will not be able to fully take advantage of the features built in to Word. Just my 2¢ worth...
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

nichiaiincAuthor Commented:
Thanks everyone!

I am going to award the points to harfang.
This code worked:
{ REF client_name \*CharFormat }

The code that was set by word and causing the problem (I still think it's a bug, since when I changed it it worked) was:
{ REF client_name \h \*MERGEFORMAT }

I don't know if it was caused by the \h or the mergeformat, but that was what I was told to put to keep the formatting. But anyways it works now!

Thanks Eric, your writeup was very informative. I never knew about the alt f9, word seems very powerful, and I just never needed to use its advanced features up until now.

I am going to award the points to harfang, but before I close this question. I was wondering if you could tell me if its possible to use the cross reference in the footer. If it's another problem that will take time to solve I will create another question on EE. But when I put the cross reference in the footer of each page (for example I have a contract number on the first page and I want it to fill in the footer of the document) it doesn't update the footer's crossreference. Any ideas why not?
Eric FletcherConnect With a Mentor Commented:
Footers need to be updated to show field results. Switch to normal view and back to page layout view to force the recalc. Print preview will do it too. A REF field in the footer will display only the bookmarked value; if you want to show changing values -- as you might for dictionary or telephone book style header/footers -- use the STYLEREF field instead.

Harfang's method will work, and uses Word's field code switch features to make use of the font formatting attributes set with the field code. This is quite clearly described in Word's help. The behavior you describe is NOT a bug; it is just that you are expecting the field to work in a way it is not designed to work.
For what it's worth, I concur with Eric (and I think you should split points to acknowledge his explanations, even if you end up using my suggestion).

Reading your descriptions, I really think you should not use bookmarks, but document properties for this. They do not have any implicit formatting, contrary to bookmarked text, they allow for better automation, and are a "cleaner" solution to what you need.

From the menu, choose (File | Properties), [Custom] tab, type Name: ContractNumber, Value: 123-123-123, click [OK]. In your document, (Insert | Field), choose "DocProperty", and then "ContractNumber"... Not more complicated than bookmarks.

BTW: the \h switch creates a hyperlink (so you can Ctrl+Click to move the cursor to the bookmark location), and is thus not related to your formatting issue.

nichiaiincAuthor Commented:
Thanks Gentlemen!

This was really helpful. I will have to look further into the document properties and the ability to actually code in word. I have never had to use it nor knew it was there. Thank you guys or your help, the form is now working as I want it to.

As Harfang humbly requested, I will award points to both of you. thank you very much again for your help!
I'm glad it was useful. Thanks for the feedback and success with your documents!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.