OpenXMLDiff vNxt – Just an easy way of doing things


Hello Guys – As I told you in my previous blog post, that I am working with Eric on the updated version of OpenXMLDiff. The good news is, I have it ready! It’s uploaded on Go, Play with it … 

So, I am sure you’ll have many questions – what’s different? what’s changed? is it a console app? how can you use it? et cetera .. answering em’ all below:

The initial idea behind OpenXMLDiff was to find a easy way of comparing two office files. Once you start writing you OpenXML code, sometimes you’ll find it very necessary to know what’s changed when you changed “X”.

Eric, me and a lot of people struggled with this issue multiple times, e.g. when I wanted to compare two files, to know why only one of a few seemingly similar files work, and others throw an error.

Granted – we have other ways, but nothing (that I found ) was easy enough to say – “Hey! comparing OpenXML files is easy …”



This is the core file which does the actual job. I’ve build it as a class library so that you can use it directly from your code if you wish to .. you are free to write you own PowerShell scripts, Winforms apps, Wrapper dlls around it. It’s a simple object model, just one method (Generate) with a couple of overloads to give you more flexibility. This method get’s the job done. But, before you call this method, you’ll need to pass on some options and algorithm to use (basically the options decide, what should be ignored while doing a diff between files).

While generating the report, you’ll also need to tell what sort of output you want? Text or HTML. I’d recommend using the HTML output, because it can highlight the changes in the files which makes things a lot easier.

Once the output is generated, It will fire an event to notify you about the outcome, (or you can just ignore the event if you are planning to to a synchronous call, but presence of event means that you can also use it asynchronously). You catch the event or you don’t –  you will be able to get all the generated output either by using the event parameters, or the read only properties css, js, diffs, sourceparts, targetparts and output

We’ll talk about the CSS and JS afterwards, but sourceparts,targetparts and diffs are dictionaries, which will contain the parts which had differences and the diffgram explaining the differences. The output is the actual report detailing the differences (In the format you’ve selected).


Class library given above is a facility; not a compulsion – I’ve also build this Winforms application which uses above dll to generate a report.


I’ll go into further details in the next post, but first I’d want you to play with this thing and give me the feedbacks – It’s a beta, need to do a few changes yet, still, I’m sure you’ll like it!



Not responsible for errors in content, meaning, tact, or judgment. Live and let live. Toes go in first. I didn’t do it. Enjoy.

Comments (10)

  1. Here is something that is very, very cool! Pranav Wagh has built a much improved version of OpenXmlDiff

  2. I don’t do so much with Open XML these days but I still get a few questions from people and I’m still

  3. Les voici : PowerTools : Utiliser System.IO.Packaging dans PowerTools pour modifier des propriétés (Doug

  4. Georg Begerow says:

    Hi Pranav,

    good work. There is an error in the original code which also made it in the Gui Version. If there is an non-xml part like an image referenced by non maindocument like a slide in a presentation the code will try to load it as a xml. The Filter you set works only on the main level. To fix it replace the first line in method AddPart of OpenXMLDiff.vb with the following line:

       If Not partList.Contains(part) Or Not part.ContentType.EndsWith("xml") Then

  5. Georg Begerow says:

    Ups! Throw up the condition in my last comment. The correct first line of AddPart is:

    If Not partList.Contains(part) And part.ContentType.EndsWith(“xml”) Then

    Thanks a lot for the feedback George! I’ve updated the code, vNxt 1.1 doesn’t have this issue, please keep your feedbacks comming :)

  6. Pranav released another drop of Open XML Diff . There are a couple of bugs fixed. Read about Open XML

  7. Yesterday I received an email from another employee here at Microsoft to check out this tool called Open

  8. Doug Mahugh says:

    Interoperability Study. Jay Kesan and Rajiv Shah of the University of Illinois have published a study

  9. Ce post n’a pas voulu partir ni jeudi ni vendredi, le voici donc ! Des mise à jours à n’en plus finir