Content control loses font formatting when using custom XML

Topics: Developer Forum
Oct 9, 2007 at 8:24 PM
Here are the steps to reproduce the problem I am having. I am essentially following the instructions from this article

1. Create a Word docx with a Text content control. (That's the only thing added to a blank document.)
2. Format the content control as a Wingding font and save the file.
3. Open the same document in the Word 2007 Content Control Toolkit. Create a custom XML part which contains one value. For example...


4. Link the Test node to the one content control, save the docx, and close the Content Control Toolkit.
5. Open the docx in Word 2007. The content control will display it's value with a Times New Roman font. This is obviously not desirable.

I can change the font back to Wingding, but when I reopen the the docx, it's back to Times New Roman. I can change the value of the content control so that the custom XML persists the value, so I know the XPath linking is working. It may seem superfluous that the Wingding font doesn't work; however, I am using the Wingding font just for this example, because it is a standard font. My ultimate goal is to use a third party font that is exibiting the same behavior as the Wingding font.
Oct 11, 2007 at 4:39 PM
I also posted this on an MSDN forum called Innovate on Office. Harjit at MS has confirmed the issue and are looking into it further with the Office team.
Oct 12, 2007 at 6:24 AM
Hi wjhaase,

I've verified the problem is with Word, not the Content Control toolkit. Here's a simple way to reproduce the problem solely within Word.


1. Boot Word
2. Go to Developer Tab | Insert Plain Text Content Control
3. Change the font of the control's text to Wingding
3. Open VBA editor, Alt+F11. In the immediate window, copy paste the following code and then press ENTER


4. Now copy paste the following code and press ENTER

ActiveDocument.ContentControls(1).XMLMapping.SetMapping "/x"


The content control text is replaced by foo and the font is times new roman.


The placeholder text font is not blown away when the content control is updated

I've verified even after changing the font of the content control again, the font is still reverted upon update. Additionally this behavior reproduces when using styles.


Oct 12, 2007 at 2:35 PM
Thanks, Matt! I will relay this to the Word team.