Skip to main content
Jump to: navigation, search

Compare Word Documents

One this page, we describe support for comparing Word documents using Eclipse. The purpose of this page is two-fold. First, we will described the goals and features of the Word Document compare support. After that, we will dig a bit into how we integrated the Word comparison with the Eclipse Compare framework

Obtaining the Word Comparison Plug-in

The current plan is to ship this bundle with Eclipse 3.5. However, the code is compatible with 3.3. You can download the bundle from here and put it in the plugins directory of you Eclipse install.

Comparing Word Documents

In this section, we describe what our goals for the Word document merge viewer were. We then described the features of the viewer and show some screen shots of what the result looks like.

Goals and Features

When we started implementing the Word merge viewer, we had the following goals in mind:

  • Compare changes using the revision support that is provided by the Word application
  • Offer the user flexibility in whether they want to edit in-place (i.e. embedded in Eclipse) or in a separate Word Application window
  • Provide a means to save changes back to the Eclipse workspace.

To that end, we implemented a merge viewer with the following features:

  • The merge viewer is associated with the "doc" file extension and a "Word Document" content type. The use of a content type will allow the user to associate other file extensions with the merge viewer.
  • The merge viewer opens the Word based comparison in-place by default but there is a toggle in the toolbar that allows the document to be opened in a separate window.
  • The word application is opened on a temporary file containing the results of the comparison of the two files or file states being compared. Saving the compare editor (or clicking on the Save button in the compare viewer toolbar) will save any edits that have been made to the temporary file and then copy the contents of the temporary file into the Eclipse workspace files

What it Looks Like

The following screen shot shows the word comparison in-place. You can edit the text and save in the compare editor which will save the result to the 'important.doc' file that is being compared.


This next screen shot shows the compare viewer in "external" mode where the word document is open in a separate window.


We don't have a screen shot of the window since it is simply a full blown word application. Notice that the "In-place" toggle button in the above screen shot has been changed from the previous screen shot. Also notice that the editor is now dirty and the save action in the toolbar is enabled. The editor is dirty because we have made changes using the Word application. Even thought the document is shown in a separate window, we are still keeping a link to the document so we know when it has been modified. Saving in the compare editor will still work (as indicated by the text that appears in the compare viewer).


A limitation of the viewer is that it doesn't offer the ability to save if neither or both sides of the comparison are editable. For the "both editable" case, we didn't feel we could adequately present the save options in the UI. The workaround is to open the comparison in a separate window and you can then save any changes to any location on disk.

Implementing a Compare Merge Viewer

Back to the top