insert word ml into content control via open xml


  • Currently my application uses word automation to insert formatted text (word ml) into a content control, by using the content control's Range.InsertXML method. This all works, but I want to try and do the same sort of thing via the open xml sdk.

    What I was wondering - is it possible to add word ml to a content control, whilst maintaining that content control in the document (i.e for future changes to the content)?

    So, what I want to do using the OpenXML sdk:

    1) find content control in doc

    2) clear existing contents (which would be word ml) from CC

    3) insert word ml, whilst retaining the CC in the document for future updates.

    A simple example would be much appreciated.

    Many thanks.

    Friday, May 04, 2012 2:00 PM


  • I'm sory for not giving you a working example. I would just like to point you to the Docentric toolkit which does exacltly what you are looking for. To create such a solution from scratch by using Open XML SDK is painfull and error prone. If you prefere a free solution check out FlexDoc (doesn't use content controls but XMLNode controls which are not supported by MS Word 2010 anymore).
    Monday, May 07, 2012 7:38 AM