ODF translator project and its integration into Office 2007 (repurposing commands)
20 days ago, Microsoft announced the ODF translator project. Brian Jones clarified a few issues in another blog post a few days later. Currently, an early version of the ODF translator project is available for Word. It integrates into Word as an add-in. You can download a copy as well as the full source code from sourceforge.
One of the most contentious issues became right away how the ODF add-in integrates into Word. Brian claimed:
“It’s directly exposed in the UI. We’re even going to make it really easy to initially discover the download. We already need to do this for XPS and PDF, so we’ll also do it for ODF. There will be a menu item directly on the file menu that takes to you a site where you can download different interoperability formats (like PDF, XPS, and now ODF).
Heck, if you wanted to be even more hardcore, the Office object model allows you to capture the save event. So if you wanted to you could make it so that anytime you hit save you always used the ODF format, just by capturing the save event and overriding it. I’m not expecting folks to do that, but it does show just how extensible Office really is. ”
The following screenshot shows the default integration as an ODF menu item in the Office button menu with an associated flyout containing the Open and Save commands:

It didn’t take long for the criticism to start. Rob Weir, for example, critiqued in his blog post that ODF cannot be found in the Save As and Open dialogs nor can be made the default file format.
As this is an UI issue, I decided to take a closer look.
The facts
-
Let me start out with one simple fact: The ODF translator add-in has to make do with what currently exists in the Office 2007 extensibility model. Why?
-
Microsoft is providing ODF support as an add-in, not as a built-in feature. That means, the add-in is limited to what every other Office add-in can do. As it is not a built-in feature, Microsoft was able to announce it as an open source project.
-
Microsoft isn’t going to provide any special MS-only hooks in Office 2007 just to integrate the ODF, PDF & XPS things into it. MS-only hooks would just be a waste of development resources and non-MS add-in developers would want to use them as well (which would be simple due to the open source nature of the ODF translator project). Hence, this is either going to happen through a normal Office 2007 add-in mechanism, or not at all.
-
The Open & Save As dialogs cannot be customized: There simply is no way for an add-in to add another file format to the file type list in those dialogs. I checked this with the Office beta team just to be sure.
-
It is possible to write a custom file import/export converter for Word. This would add the file type supported by the converter to the file type lists in the Open and Save As dialogs. Unfortunately, this is not an option for the ODF translator project. Such a custom converter would convert between RTF and the desired format, which simply misses the point for the ODF translator add-in. For more details, see the respective MS KB article.
-
The ODF translator add-in is therefore limited to what can be done via RibbonX.
Why not provide the ability to customize the Open and Save As dialogs?
-
ODF support was clearly an after-thought for Office 2007. It was announced after the release of Beta 2. Office 2007 was for the most part feature complete with Beta 2 and it is therefore extremely unlikely that Microsoft is going to make any substantial changes to the extensibility model between now and RTM.
-
Why should MS waste resources on providing one particular feature for add-in developers that most Office add-in developers (all not affiliated with Microsoft) would put at the very bottom of their wish list? How many add-ins would actually use such a feature (answer: 3; ODF, PDF, XPS). Sorry, but providing such a feature to satisfy 3 add-ins is a real waste. There is so much missing in Office 2007 from the point of view of an add-in developer, that MS has enough work for the entire next release (after 2007) before even considering the Open & Save As dialogs issue.
-
For more about this, see my blog comment.
The RibbonX side of it
If you download the source code, you’ll find a file named “customUI.xml” in the OdfConverter\source\OdfWord2007AddIn\resources folder. The file contains the RibbonX code that the add-in uses:

This RibbonX snippet shows how simple the integration of this add-in into the Office button menu is. Let’s see how we can modify this.
The first modification we can easily make is to get rid of the ODF menu and integrate it differently into the menu. The following screenshot shows the Open ODF command directly below the Open command, and integrates the Save as ODF command into the Save As flyout:

In order to accomplish this, we’ll need to use the following RibbonX:

The modification of the splitButton “FileSaveAsMenu” shown above adds an item to the Save As flyout. The “insertAfterMso” attribute specifies the exact position in the flyout menu and in the menu itself. You can see from this example that the order of the items in the XML code doesn’t matter when we use this attribute. The Open ODF button is in the XML below the modification of the Save As flyout, but the button nonetheless right after the built-in Open button.
The only effort required to use this customization is to change the “customUI.xml” file and rebuild the add-in with Visual Studio 2005.
Providing our own Open and Save As dialogs
A much more sophisticated customization is to replace the existing Open and Save As dialogs with our own ones and also to override the Save command. This should never be used for add-ins in an uncontrolled environment, as my UI style guide explains. I would like to discuss the option here though, because of the way I see the ODF add-in being used:
Most average users really don’t care about ODF vs. OpenXML. All they want to do is save their files and they are hardly ever going to change the default file format anyhow. As Brian has pointed out before, ODF doesn’t support all of what OpenXML supports, and hence ODF is not useful for most users as the default file format for Office 2007 (lack of full fidelity).
Most people who will use ODF will do so due to company/agency policy. That means, the ODF add-in will be preinstalled for them by their network administrators. Network administrators can easily change the add-in (one of the benefits of open source) in such a manner that ODF will be the default for open and save. Everyone else who downloads the ODF add-in, will actually know what they are downloading and will have no problem finding it at its prominent location in the Office button menu.
That means, I see this add-in either use in a controlled environment where repurposing is no problem, or by power users who can either choose to use the repurposed version or easily use the menu items in the Office button menu.
In order to override the built-in features and render ODF the de facto standard file format, we’ll need to override three things: Open, Save and Save As. In RibbonX, the result looks like this:

You might be wondering about the enabled=”false” in this and all previous RibbonX snippets. The code for saving in the ODF format isn’t implemented yet in the Word add-in that was released on July 5, 2006. Once it is implemented, those attributes can simply be removed. The above RibbonX code assumes that ExportODF handles the different behavior of “Save” and “SaveAs”.
In the C# code of the add-in itself, the signatures for ImportODF and ExportODF need to be changed to:
public void ImportODF(IRibbonControl control, ref bool fCancelDefault)
public void ExportODF(IRibbonControl control, ref bool fCancelDefault)
fCancelDefault determines whether the built-in action is executed after the repurposed action or not. If fCancelDefault is true, then the built-in action will not be executed. For the ODF add-in, fCancelDefault should be returned as true therefore.
This modification changes the default file format of Word 2007 to ODF. At the same time, it doesn’t allow the user to save in any of the built-in file formats. In order to make this add-in behave more realistically, the Open and Save As dialogs in the add-in should include the default file formats and trigger the respective action via the Word object model. In addition, when ODF was chosen as file format, the add-in should disable all functionality in Word that cannot be saved in ODF. This is similar to the Compatibility Mode in Word 2007: When working on a Word 97-2003 file, features that are specific to Word 2007 are not available. I could imagine e.g. that SmartArts would be disabled in an ODF Compatibility Mode. Maybe someone in the community is going to implement such a more advanced add-in and it will be provided as an alternative on sourceforge?

September 4th, 2006 at 8:09
nice information, thank you
September 8th, 2006 at 4:33
This is interesting material, but as you pointed out, it cannot be applied by default in an add-in approach. All what we could do is to provide an “advanced setup” during the installation process that would ask for replacing default open and save dialog boxes (that would prevent sys admin to have to recompile the project, even if that’s not that hard). There would still be some issues to address, because internally we work with docx files (but I think we can find solutions). I’ll push this subject to be discussed on the next team meeting.
Best regards,
Jean (ODF Translator project manager)
September 10th, 2006 at 4:17
[…] wouldn’t go worse if they supported it! Share this post: Email it! | bookmark it! | digg it! | reddit! PubliĆ© vendredi 8 septembre 2006 22:06 parneodante […]
September 28th, 2006 at 19:42
You state:
“It is possible to write a custom file import/export converter for Word. This would add the file type supported by the converter to the file type lists in the Open and Save As dialogs. Unfortunately, this is not an option for the ODF translator project. Such a custom converter would convert between RTF and the desired format, which simply misses the point for the ODF translator add-in. ”
Microsoft have created converters for Word 2003, 2002 and 2000 which allow those applications to open and save Word 2007 format files with the file formats listed in the Save As dialogs. For the full fidelity they claim that conversion process must not go via RTF.
Is this a case of Microsoft saying - “you must do it this lame/broken way” while keeping the knowledge about the good/better UI way to themselves?
Simon Jones
Contributing Editor
PC Pro Magazine
September 28th, 2006 at 20:35
Hi Simon,
You are talking about the Awareness Update half of the Compatibility Pack. The Awareness Update patches Office 2003 so that they can be aware of the 2007 file formats. The other half of the pack are the actual OpenXML converters.
The awareness update actually modifies Excel, PPT and Word 2003 itself. Essentially it is a patch for those programs similar to the Office 2003 Service Packs. This means the actual codebase is being modified to integrate those file formats into Office 2003. Obviously the actual Office codebase can only be modified by Microsoft, so in that sense they are keeping all third parties away from it.
Without modifying the Office codebase, there is no way to add file formats converters to Office except in the Word RTF case explained above.
In all cases where even Microsoft cannot modify the codebase, but has to provide an add-in, they had to resort to one of the methods explained above. The best example is the PDF/XPS add-in that is now no longer built into Office 2007. Up until Beta 2, the Office Save As dialog would list the respective Office file formats as well as PDF and XPS. In B2TR, PDF & XPS are no longer listed there. Instead if you go into Save As, PDF/XPS, you’ll notice that the only file formats listed in the Save As Dialog there are PDF & XPS. Essentially Microsoft made a new save as dialog for those two file formats. Hence, Microsoft’s own PDF/XPS add-in is integrated into Office 2007 the exact same way as the ODF add-in.
I hope this explains it.
Patrick
May 17th, 2007 at 9:10
Ah, before I had thought that Microsoft was being intentionally anti-competitive in their refusal to allow an addon to add a format to the Save-As menu. Now I realize that their hands were tied; they would if they could, but they can’t. If only we could find the jerks who forced Microsoft into that design decision against their will, I’m sure– I’m sure Microsoft would be very thankful. Thanks for clearing the issue up.