So Mohit and I were at WPC last week, and while we were hanging in the booth, a customer came up with a very interesting problem.
Essentially, the customer needed to be able to have their Word documents saved to Windows Azure, in a format that could be opened in Word, but also consumed by a legacy Java application.
I promised I would see how hard it would be, and so while waiting for Yil to cook Sunday lunch, I had a quick crack at it.
First step, I created my own ribbon in Office, using the new Office Add-in projects in VS 2010.
Added in a ribbon visual designer.
Which ended up looking like this.
The code was very easy, essentially on the click event, I saved the contents of the doc to a blob.
The key part is to call the WordOpenXML method on the ActiveDocument.Content property, to get the OpenXML version of the doc.
A quick test.
And… you little bewdy. Now, I’ve set the content-type to the docx content type for dramatic effect, as otherwise the XML would just load in my browser, and not let me save it. When I save it to my desktop, I save it as xxx.xml, and when I double click on it, it loads in Word.
The next step for this would be to create a Web Role to list the documents that have been saved to the blob store, to make it nicer to view, but in terms of proving this little bit of functionality, I’m pretty happy.
Here is a link to the code in case you’re interested.