I am very excited about the Document Interoperability Initiative (DII) event that Doug recently announced, which is coming up in May. The event is taking place in London where Fraunhofer will be sharing a community project they recently started to create an IS29500 validator and test document library. This project was started to address feedback from developers at past DII workshops about the need for a validator to ensure that the IS29500 documents they create will interoperate well with other implementations. They clearly stated that implementers need a place where they can go to download tools and resources that allow them to validate their documents against the IS29500 standard. While Microsoft is one of the contributors to this project, this is a community project that anyone can contribute to.The DII event in London is a free event that anyone can attend. I’ll be there to update everyone on some of the things we’re currently doing to enable interoperability, and I’m also managing registrations for the event so if you would like to come, send me an email and I will provide you with the event details. Fraunhofer will be sharing details on how you can contribute to the community project. If you are not able to make it to the event, but still want to contribute, soon you will be able to go to the project website to read about it and sign up. I will post details as soon as they are available. If you have any specific questions about the project, let me know and I will do my best to answer your questions.
You may have heard that Office 2007 SP2 will now support editing files in the OpenDocument 1.1 (ODF) format. This document format was added to Office’s long list of supported documents formats to give customers more choices for the format they use to save their documents.
In addition to allowing you to edit the ODF 1.1 format within Office 2007, SP2 also supports a new External File Format API that can be used to edit other document formats as well. With this API, users can choose to save their documents in any format they want. In this post we will explore how to use the API to enable Office 2007 to edit our own custom document format. We will then use Office 2007 to save our custom format as DOCX, ODT and HTML.
For the purpose of this article, we have a company who needs to manage their sales pipeline information. The data is available as XML, but they do not want to spend the money to build a custom editor. They just want to let their users edit the pipeline data in Word, as a table. They give these files an extension of SPLX (i.e. Sales PipeLine Xml)
The sales pipeline information is made up of a series of SalesItem tags, each with a unique id that represents the index of the item. They track the name of the customer (CustomerName), how much the deal represents (DealValue) and a percent that represents how confident they are that the sales opportunity will close (ConfidencePercent).
Here is the sample XML file:
We will create an External File Converter that will transform the XML into a WordprocessingML, document when opened; and then transform the respective document format back to the XML format when saved. This will allow the users to edit the sales pipeline information in Office 2007, while keeping the data in their own XML document format.
Use the following list of steps to create an out-of-process COM object.
Now that we have created a COM server it is time to create our External File Converter COM object. Use the following steps to create the COM object:
Now that we have created a basic External File Converter, it is time to customize the HrImport and HrExport methods. The HrImport method will be customized to convert our Sales Pipeline XML into a Word table when opened. The HrExport method will be customized to convert the Word table into our Sales Pipeline XML when saved.
You are now ready to test your custom External File Converter.
You can also edit your sales pipeline information in the ODT format by doing the following:
You can also save your custom format in any other format that Office 2007 SP2 supports. For example, you can use the Save As feature of Word to save the document as HTML.
If you want to create your own Open XML External File Converter, you can read more about and download the API on MSDN. The MSDN article has a link to a code sample that you can download.
As always, let me know if you have any questions or comments.J