I’ve been experimenting with building an Outlook 2010 addin in C#, using Visual Studio 2008. I am able to obtain a Microsoft.Office.Interop.Word.DocumentClass object from a Microsoft.Office.Interop.Outlook.Inspector object, which represents the e-mail being currently edited. I understand that this DocumentClass is used in various other contexts too (usually for Microsoft Word extensions, unsurprisingly).
That class helpfully has a property called WordOpenXML, which seems to be an XML representation of all the files constituting the the .docx package which would be saved to disk when saving this Word document as a .docx.
One way this property would be very useful is if it could be converted into a System.IO.Packaging.Package object in memory; ie. deserialize it. Does anyone know whether there is an easy way to do this, or do I need to write some XML parsing code to do it manually?
I ended up modifying some code I found online to create a method which converts
WordOpenXMLto a Package, which is saved to disk: