CustomXml and rich text (rtf)



    I start to work with OpenXML in Word2007. Particularly, with saving of the data entered by the user to Custom XML.


    I have download Content Control Toolkit utility. If i create connectivity richtext field to part of customxml, and load .docx in Word2007, then i see plaintext control (not rich text).


    Question: How to set relation between custom xml tag and richtext control ?



    Thank you.


    Wednesday, December 05, 2007 9:07 AM

All replies

  • Hi Alexander,


    data-binding rich text controls is not supported. You can try using the Word UI, just run the following VBA in a document containing only 1 content control of type rich text


    Dim part as CustomXMLPart

    set part = ActiveDocument.CustomXMLParts.Add("<someXml/>")

    ActiveDocument.ContentControls.Item(1).XMLMapping.SetMapping "/node"

    Hope it helps,




    Wednesday, December 05, 2007 3:03 PM
  • Hi Wouter,


    I have tried it, but i had run-time error '6191'. "Data bindings cannot be created for rich text content controls".


    I have found note about SetMapping method (

    "Note: Creating a mapping for a rich-text content control causes a run-time error."


    Why data-binding rich text controls isn't supported in Word 2007 ?


    What other methods to keep a user rtf text in custom xml are ?




    Best regards,

    Alexander Dyuzhev

    Thursday, December 06, 2007 8:50 AM