none
XML Mapping for Rich Text content controls in Word 2013 RRS feed

  • Question

  • Hello Everybody,

    While going through what's new for Content controls with Word 2013 article located here , found out that Office (Word) 2013 is going to allow XML Mapping for Rich Text Content controls. See below the portion of text from the article

    Content control improvements in Word 2013


    In Word 2013, content controls provide three key improvements: improved visualization, support for XML Mapping for Rich Text content controls, and a new content control for repeating content.

    Does this mean Word 2013 onwards, it is possible to bind the XML data with Rich Text content controls? If anybody having details or sample code, please share.

    Thanks,

    Niranjan

    Monday, January 21, 2013 10:08 PM

Answers

  • Hi Niranjin

    <<Does this mean Word 2013 onwards, it is possible to bind the XML data with Rich Text content controls?>>

    Yes.

    As far as the object model goes, the code for mapping looks to be the same as for plain text content controls. You'll find a (VBA) code sample in the article you quote.


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, January 22, 2013 9:03 AM
    Moderator

All replies

  • Hi Niranjin

    <<Does this mean Word 2013 onwards, it is possible to bind the XML data with Rich Text content controls?>>

    Yes.

    As far as the object model goes, the code for mapping looks to be the same as for plain text content controls. You'll find a (VBA) code sample in the article you quote.


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, January 22, 2013 9:03 AM
    Moderator
  • Thanks. I will try the VBA samples.
    Tuesday, January 22, 2013 4:01 PM
  • You'll find a (VBA) code sample in the article you quote.

    Cindy Meister, VSTO/Word MVP, 

    Hi, I've tried the code, ti works fine.

    My problem is that as soon as I put some styles in the rich text content, the XML mapping is replaced by the full (escaped) XML document representing the docx.

    Somethig like :

    <x>&lt;?xml version="1.0" standalone="yes"?&gt;
    &lt;?mso-application progid="Word.Document"?&gt;
    &lt;pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage"&gt;&lt;pkg:part pkg:name="/_rels/.rel

    ...

    </x>

    Bug ? Is there a way to avoid this ?

    Thanks, Pierre

    Thursday, April 7, 2016 11:01 AM