How to store user selected Custom Properties of Word addin in XML RRS feed

  • Question

  • I have developed an Word addin in which when user save the document he is prompted to choose a document classification(Public, Confidential, Secret) and put the selected thing in header, footer and watermark.

    Now I want to create a custom installation package for the addin in which while installing the addin user will choose the font (style, size, bold, italics) , and header footer setting (center, right and left) and this should be stored in xml file or any config files which is not visible to user and afer the addin is installed the Word should work according to these settings selected by the user. I have written seperate functions for  header footer,save file and watermark.

    Please tell me the way what should I do to store these selected settings and to configure word to follow these settings.

    Will the serialization and deserialization will be of any help??

    And if possible tell me how to develop this custom installation package also.



    Thursday, June 27, 2013 8:10 AM


  • Hi Gaurav

    You can store settings in any manner you wish, as you would for an Visual Studio solution. There's nothing specific to VSTO or Office.

    There's also no way to link Word up to any such settings. Formatting in Word is controlled by styles, and each document will have its own set of styles saved with it. Code in your add-in would need to look up the selected settings and apply them to documents, as appropriate. Since you don't provide any additional details about how things should work, it's really not possible to provide any more detailed suggestions...

    If your add-in is meant to generate a certain type of document or selection of documents, one possibility would be to distribute the corresponding Word templates (*.dotx) files as part of your add-in. At installation time, it could manipulate the files' Word Open XML to write the formatting specifications in a set of styles prepared in the templates. When new documents are created from the templates, they'll automatically have the formatting.

    In Word it's also possible to protect the document for formatting, limiting what the user can change in this respect.

    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, June 27, 2013 2:05 PM