Comparing Two Open XML Packages with Open XML Diff

Published 31 July 08 04:18 PM

Yesterday I received an email from another employee here at Microsoft to check out this tool called Open XML Diff that he was working on. His name is Pranav Wagh and he just released another drop of the tool which you can read about oh his blog.

You can use Open XML Diff when writing code to generate an Open XML document when you're not quite sure what XML it is that you need to write. Say you know how you want the document to render in Word, but are unsure about which element or attribute to tweak.  You can save a copy of a doc, modify it, save it again, and compare the two which helps you figure out what XML you need.

I downloaded the source but had a couple trust issues on my Vista box because the projects are looking for the xmldiffpatch.dll, which the instructions said to install first from here, but that setup places the assembly off of C:\Program Files\ and it's a NO NO in Vista to reference assemblies there. Then I noticed that Pranav was supplying the xmldiffpatch.dll in the OpenXMLDiff\bin\Release folder already. So I created a single solution for the three projects and set a project reference from the OpenXMLComparer Winforms client to the OpenXMLDiff library and another project reference from the OpenXMLDiff library to the ViewRenderer project. Then the only binary reference you need to set up is to the xmldiffpatch.dll. Finally I set the OpenXMLComparer as the startup project and rebuilt the whole solution without problems.

So to test the tool I took the MyDocument.docx Word document from my last post that just contains the text "This is my document." and saved a copy called MyDocument1.docx and made a simple change; I made the entire sentence bold. Then I compared the two documents. The report found three xml files in the package that changed. The important one being the MainDocument part, document.xml. Here's a snapshot of part of the report where you can see the differences:

Pretty slick! It really helps me understand what changes are applied to the Open XML package based on changes I make through Office. Much more intuitive than reading Office specs ;-)

Make sure to provide feedback on the Open XML Diff site.

Enjoy!

Filed under: , ,

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 » Comparing Two Open XML Packages with Open XML Diff said on July 31, 2008 7:53 PM:

PingBack from http://blog.a-foton.ru/2008/08/comparing-two-open-xml-packages-with-open-xml-diff/

# Joycode@Ab110.com said on September 19, 2008 6:32 AM:

[原文作者]: Beth Massi [原文链接]: Comparing Two Open XML Packages with Open XML Diff 昨天我从微软的一员工那里收到一封email,内容是关于体验一下他正在设计的一个工具Open

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required

About Beth Massi

Beth is a Program Manager on the Visual Studio Community Team at Microsoft and is responsible for producing and managing content for business application developers, driving community features and team participation onto MSDN Developer Centers (http://msdn.com), and helping make Visual Studio one of the best developer tools in the world. She also produces regular content on her blog (http://blogs.msdn.com/bethmassi), Channel 9, and a variety of other developer sites and magazines. As a community champion and a long-time member of the Microsoft developer community she also helps with the San Francisco East Bay .NET user group and is a frequent speaker at various software development events. Before Microsoft, she was a Senior Architect at a health care software product company and a Microsoft Solutions Architect MVP. Over the last decade she has worked on distributed applications and frameworks, web and Windows-based applications using Microsoft development tools in a variety of businesses. She loves teaching, hiking, mountain biking, and driving really fast.

This Blog

Syndication

Page view tracker