Share via


Open XML Package Editor Power Tool for Visual Studio 2010

The VSTO team today announced the release of the new Open XML Package Editor for Visual Studio 2010!  This is an indispensible tool in every Open XML developer’s toolbox.

This Power Tool is a Visual Studio add-in that provides an easy way to manually edit Open XML documents.  Once you install the add-in, you can drag an Open XML document into Visual Studio, and browse through the parts, and open specific parts for editing in Visual Studio's XML editor.  Visual Studio doesn't keep the file open, so you can use it in the following scenarios:

  • This blog is inactive.
    New blog: EricWhite.com/blog

    Blog TOCYou can using Word 2010 to create a file, save the file, and close Word.  You can then drag the document onto Visual Studio, and look at the markup that was created.  You can then open the doc again in Word, change it, close it, and then Visual Studio will tell you that the file has changed outside the editor.  You can tell VS to reload the doc, and see the changed markup.  Because the Open XML Package Editor doesn't keep the file open, you don't need to close the file in VS before opening it again in Word.

  • You can write a program to manipulate the document in C# or VB.  If you have the Open XML document open in VS, you can run the program, and VS will tell you that the file has changed, and you can reload to see the results of your modifications.

  • You can manually modify the XML, and open the file in Word to see if your manual modifications worked and did what you wanted.  You can then close the doc, tweak the XML, and open it in Word again.

This is a very convenient way to examine and edit the XML in Open XML docs!

Of course, Word does not indent the XML when serializing.  You can use the XML formatting option in the XML editor to make it easy to view and edit the XML.  I like to set an option in VS so that when you format the XML, it lines up the attributes.  This is a far easier way to see the XML when there are lots of attributes, or lots of namespaces.  To set this option, select Tools, Options on the menu, expand Text Editor, expand XML, click on Formatting, and set the option, "Align attributes each on a separate line".

To format an XML document, select Edit, Advanced, Format Document on the menu (or type ^e, d).

Download: Open XML Package Editor Power Tool for Visual Studio 2010

Important Note: You must exit Visual Studio 2010 before installing. If you install while Visual Studio 2010 is running, the package editor will not work until you exit and restart Visual Studio.

Comments

  • Anonymous
    June 26, 2010
    Oh, this is absolutely great! It was the one and only reason I kept VS2008 on a VM was to look at the markup without constantly renaming the extension to zip, unzipping and then wading through the xml files manually. Fantastic!

  • Anonymous
    June 16, 2015
    when i drag the excel addin file to the Visuval studio 2013 its directly opening the excel insted of opening in VS pleaseadvise.iinstald open xml addin

  • Anonymous
    June 16, 2015
    @vijay, I have had this happen to me - the only solution I have found is to uninstall VS and re-install, then immediately install the Package Editor Power Tool.  Wish I had a better answer for you, but I don't.  I have never been able to figure this out.