none
Extend the File Menu to add my custom Menu item RRS feed

  • Question


  • Hi all,

    I want to save the document, being composed on Microsoft Word 2007, to our servers on internet. Since I want to open my own saving window I was thinking that should I add a little menu entry to the main FILE menu (where the usual save open menu items are)? So far I dont know how to do that (please advise on this how can I add a custom menu item on the main save menu, or i cant or I shouldnt because there is a better option?), so I followed a simple code found on msdn which was written for Office 2003 with VS 2005, and ran it on Office 2007 on VS 2010. Things run just fine and what happens is that on the ribbon interface on Word 2007 a new ribbon item gets created automatically called "Add-ins" which contains the menu item I created. The functionality will be save/open.

    On save right now I'm opening a custom made window in C#, its going to behave as the save dialog for our internet servers. Now my second question where I'm confused is that naturally I'm doing to need the saved document which the user was just composing (in the form of a doc/docx file right?) and then send it to the servers on internet. Should I use the Save() method of DocumentBase to save this currently written document to a temp location on the user's drive and then open and stream it to the servers I want chunk by chunk? How does that sound?

    Please advice, thanks.

    ..ab

     

    PS: I want to support office versions from 2003 and above.


    Ab
    Wednesday, April 20, 2011 12:49 PM

Answers

  • Hi Ab

    Changing the "file" menu in Word 2007 or later means you need to define a Ribbon XML UI. If you want this for Word "all the time", then you need an Add-in. If you want this only for specific documents then the Ribbon XML can be defined in that document, or a template attached to the document(s).

    It will be difficult to impossible for you to support Word 2003 and above with a single solution, given the differences in the UI (menus vs. Ribbons).

    Word 2003 has an XML file format, as do Word 2007 and 2010. That of Word 2003 differs from 2007/2010, but those two can work with the old XML file format (it just doesn't support anything new in the later versions). The keypoint is that all three of these versions allow you to get the document content from within the object model using the Document.Content.XML / Document.Content.WordOpenXML properties. This means it would be possible to "stream" the documents directly to your servers, without saving to disk.


    Cindy Meister, VSTO/Word MVP
    Thursday, April 21, 2011 5:46 AM
    Moderator