Add customization to a non-VSTO Word 2010 document? RRS feed

  • Question

  • Greetings All,


    I have several Word 2010 non-VSTO documents which I want to attach a VSTO manifest/customization to.


    I know in a previous version of VSTO, Visual Studio Tools for Office 2005, there was a method "ServerDocument.AddCustomization" which could be used for attaching the manifest.  I can not find such a method in any of the VS 2010 Word classes.  So then I tried to modify the Open XML manually (just for proof of concept sake), basically doing these steps:


    1.)  Opne the docProps\custom.xml from a test document that was successfully created in the VSTO project for which you want the other documents attached to.

     <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="2" name="_AssemblyLocation">
    <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="3" name="_AssemblyName">
    <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="4" name="Solution ID">

    2.)  Copy the corresponding properties and values into the corresponding location of the non-VSTO document (docProps\cusotm.xml).  I was careful not to change the "pid" (this is I"m assuming used for internal references).  So everything was the same in both files except for the "pid".

    After doing this and trying to open the document, I get the following error:

    "The file blah.docx cannot be opened because there are problems with the contents.  Details:  Microsoft Office cannot open this file because some parts are missing or invalid."


    What am I doing wrong?  What is the Microsoft recommended way of simply trying to attach a VSTO 2010 manifest?


    Thanks in advance,



    Khalid K.
    Thursday, June 9, 2011 9:02 PM


  • Hi Khalid K,

    As far as I know, open xml sdk does not support add customization to attach managed code extensions to documents.

    I think it is better to use AddCustomization to attach managed code extensions to documents. Please take  a look at this article : which introduces about adding customization to Office 2010 document and it contains some code snippets.

    Hope the article can help you and just feel free to follow up after  you have tried.

    Best Regards,

    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Bruce Song Friday, June 24, 2011 1:09 PM
    • Marked as answer by Bruce Song Tuesday, June 28, 2011 12:42 PM
    Monday, June 13, 2011 4:45 AM