Handy Visual Studio Add-In to View Office 2007 Files
Last month when I was in Redmond I mentioned to a colleague that I really liked the Open XML format that Office 2007 was using now and how I had been playing with the format and LINQ to XML. He pointed me to the VSTO Power Tools which contains a Visual Studio Add-In called the Open XML Package Editor. This tool allows you to view Office 2007 files from Word, PowerPoint and Excel in a neat little treeview that lets you navigate the Open XML file and manipulate all the parts individually. After installing the VSTO Power Tools, just double-click on the Office 2007 file directly from your Visual Studio project to open the tool.
<From the VSTO Power Tools documentation:>
Open XML Package Editor
This is a Visual Studio 2008 add-in to allow parsing and editing of Open Packaging Conventions files, including Word, Excel and PowerPoint documents. Features include:
- Open any Office 2007 Open XML Package file or XPS Package file directly in Visual Studio.
- Intuitive, browsable tree view of the Package file.
- Open any XML part directly in Visual Studio’s rich XML editor.
- Easy to use user interface for adding and removing parts and relationships.
- Import and export part contents to and from files.
- Detects when a Package file that is opened in Visual Studio is modified externally. Prompts user to reload without having to close any open XML part editors.
- Create new Office Packages from a set of templates using Visual Studio’s File > New dialog.
Figure 1 shows the treeview that is provided when you open an Open XML Package file in Visual Studio:
From the treeview, if you double-click on any XML part in the file, that part will be opened in the standard Visual Studio XML editor, as shown in Figure 2:
One thing I noticed is that if the XML editor opens and the XML is all on one line with no breaks then just select all the contents and cut then paste it back into the editor and it will put the proper line breaks in there for you (Ctrl + A,X,V).
There are nine other tools included in the VSTO Power Tools that I highly recommend trying out if you are doing any kind of Office development with Visual Studio. Also check out the VSTO Team Blog and VSTO Developer Portal for more information on Office development with Visual Studio.