Content control loses font formatting when using custom XML

Topics: Developer Forum
Oct 9, 2007 at 9:24 PM
Here are the steps to reproduce the problem I am having. I am essentially following the instructions from this article http://blogs.msdn.com/acoat/archive/2007/03/01/linking-word-2007-content-controls-to-custom-xml.aspx.

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...

<root>
<Test>123</Test>
</root>

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 5: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.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2248785&SiteID=1
Coordinator
Oct 12, 2007 at 7: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.

REPRO STEPS:
===========

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

ActiveDocument.CustomXMLParts.Add("<x>foo</x>")

4. Now copy paste the following code and press ENTER

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

ACTUAL RESULTS:
============

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

EXPECTED RESULTS:
=============

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

NOTES:
=====
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.

------------

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