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 …”
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.