Welcome to MSDN Blogs Sign in | Join | Help

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 http://code.msdn.com/openxmldiff. 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 …”

image

OpenXMLDiff.dll

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).

OpenXMLComparer.exe 

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.

image

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.

Published Friday, July 11, 2008 11:31 AM by Pranav Wagh

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# a-foton » OpenXMLDiff vNxt - Just an easy way of doing things

Wednesday, July 16, 2008 3:22 PM by Eric White's Blog

# A New Version of OpenXmlDiff (with a Graphical User Interface)

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

Thursday, July 17, 2008 2:02 PM by Mike Ormond's Blog

# Diffing Open XML Files

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

Friday, July 18, 2008 4:30 AM by Julien Chable

# [Open XML] Les liens de la semaine 14/07/2008

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

Monday, July 28, 2008 10:34 AM by Georg Begerow

# re: OpenXMLDiff vNxt - Just an easy way of doing things

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

Monday, July 28, 2008 12:02 PM by Georg Begerow

# re: OpenXMLDiff vNxt - Just an easy way of doing things

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 :)

Wednesday, July 30, 2008 5:29 AM by Eric White's Blog

# Version 1.2 of Open XML Diff Released

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

Thursday, July 31, 2008 7:18 PM by Beth Massi - Sharing the goodness that is VB

# Comparing Two Open XML Packages with Open XML Diff

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

Saturday, August 09, 2008 11:30 AM by Doug Mahugh

# Links for 08-09-2008

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

Monday, August 18, 2008 3:49 AM by Julien Chable

# Lien de la semaine 11/08/2008

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

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker