Sharing the goodness…
Beth Massi is a Senior Program Manager on the Visual Studio team at Microsoft and a community champion for .NET developers. Learn more about Beth.
More videos »
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.
PingBack from http://blog.a-foton.ru/2008/08/comparing-two-open-xml-packages-with-open-xml-diff/
[原文作者]： Beth Massi [原文链接]： Comparing Two Open XML Packages with Open XML Diff 昨天我从微软的一员工那里收到一封email，内容是关于体验一下他正在设计的一个工具Open