Graphical Diff for ODF documents using OpenOffice.org

At work we use Subversion for just about all our software project data: source code, design documents, reports. Design documents are usually in MS Word, Excel and Visio. TortoiseSVN is great at using MS Word's "track changes" feature to do a graphical diff of two versions of a document.

At home, I use Linux and Subversion, and also store my ODF (OpenOffice.org) documents in Subversion. So I've been interested in getting a graphical diff feature working for these documents too, which can be started from the command line, and ideally integrated with Subversion.

Recently I found a Python script to do this in "OpenOffice / OpenDocument diff" on the Catarsis blog. That in turn was based on the OpenOffice.org diff script used in TortoiseSVN.

I wanted to make some improvements to the script:

  • in the original post, the straight quotes are converted to curly quotes by the blog software, which must be reversed to get it running in Python
  • filenames weren't being passed as command line parameters
  • it didn't work properly on Gnome in Ubuntu, due to some invalid assumptions about whether the just-opened document has the focus in the window manager when it is opened
  • it required the user to first manually start OpenOffice.org with the special parameters needed for the scripting to work

So, I've made these improvements. I've got the changes in a Mercurial repository, now hosted on bitbucket.org in the repository: cmcqueen1975/oodiff.

I have been running this on Ubuntu Linux 9.04 (Jaunty). I have not had success running it on Windows.

This script integrates nicely into Mercurial workflow using the extdiff extension. I've got it set up so I can just type hg oodiff file.odt to see how an ODF file within my Mercurial working copy has changed.

 


Download from Mercurial repository:

 

http://bitbucket.org/cmcqueen1975/oodiff/

Articles: 

Comments

I downloaded this but I

I downloaded this but I couldn't get it to work, what's the usage? I'm using standard Jaunty with gnome.

Dependencies

Hello. Ah yes—dependencies. Try installing the package python-uno using Synaptic Package Manager (under System-->Administration menu). If it's still giving you grief, let me know the error message you get, and hopefully I can tell you something useful.

Thanks, works great! Very useful tool.

Thanks, works great! Only feedback is that a different colour rather than the line through in the same colour would be a huge help in usability. But a very useful tool, nice work.

Just automating a built-in feature

Hello. I should clarify—this code doesn't implement the feature, the feature already exists in OpenOffice. This code just automates it so a diff can be started from the command line. If you want to do a diff in OpenOffice.org via the menus, you can do it this way:

  1. In OpenOffice.org (e.g. Writer) open the first document you want to compare
  2. Select menu Edit-->Compare Document...
  3. In the Open dialog box that comes up, choose the second document you want to compare

Thanks

Thanks for the tip about open office.
However, does anyone know of a graphical way of comparing power point slides?

Thanks.

Add new comment

Editor Filtered with Scriptures

  • Web page addresses and e-mail addresses turn into links automatically.
  • Scripture references will be linked automatically to an online Bible. E.g. John 3:16, Eph 2:8-9 (ESV).
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <br>
  • Lines and paragraphs break automatically.

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.