Compare Excel, Word and PDF Files in Visual Studio Team Foundation Server 2010

This post could be interessting for you, if you get the message “Binary files differ” in Visual Studio.

Comparing two files is a common task for a developer. When using Team Foundation Server as source control, it is very comfortable using Visual Studio’s built-in compare feature for file history. However when comparing Office documents like Word (.doc, .docx), Excel (.xls, .xlsx) or even .pdf things become difficult. The only information you will get is that files are different. It is not possible to see the differences as it is possible in the way of simple text code files.

How Office documents can be compared?

To compare these file types you need another diff tool that is able to compare that files and integrate it in your Visual Studio. I’m using WinMerge which is cost free and comes with a lot of plugins.

1. WinMerge with xdocdiff Plugin

At first you need to download WinMerge and xdocdiff Plugin. WinMerge is a very good and common tool to compare files. The xdocdiff Plugin enables WinMerge to compare Microsoft Office documents.

Please read the installation guide of xdocdiff to configure the plugin in WinMerge.

xdocdiff supported file formats

  • .rtf – Rich Text
  • .docx/.docm – Microsoft WORD 2007(OOXML)
  • .xlsx/.xlsm – Microsoft Excel 2007(OOXML)
  • .pptx/.pptm – Microsoft PowerPoint 2007(OOXML)
  • .doc – Microsoft WORD ver5.0/95/97/2000/XP/2003
  • .xls – Microsoft Excel ver5.0/95/97/2000/XP/2003
  • .ppt – Microsoft PowerPoint 97/2000/XP/2003
  • .sxw/.sxc/.sxi/.sxd –
  • .odt/.ods/.odp/.odg – Open Document
  • .wj2/wj3/wk3/wk4/123 – Lotus 123
  • .wri – Windows3.1 Write
  • .pdf – Adobe PDF
  • .mht – Web Archive
  • .eml – Exported files from OutlookExpress

2. Ensure WinMerge and xdocdiff is working

To ensure that everything is working you should compare two Office documents using WinMerge manually.

3. Configure Visual Studio 2010 to use WinMerge

Go to Visual Studio / Options / Source Control / Visual Studio Team Server

Use the following settings to configure WinMerge to act as compare tool.

Extension: .doc,.docx,.xls,.xlsx,.pdf
Command: C:\Program Files\WinMerge\WinMergeU.exe
Arguments: /x /e /ub /wl /dl %6 /dr %7 %1 %2

In the Extension field you can add all xdocdiff supported formats from above.

4. Test Compare feature

Here I’m using a simple Excel file that looks like this…

In the Source Control Explorer of VS navigate to a controlled Excel document, view the History and click Compare.

5. Compare Result

WinMerge will open automatically and show the difference of the two versions.


5 thoughts on “Compare Excel, Word and PDF Files in Visual Studio Team Foundation Server 2010

  1. […] Team Foundation Server ← Compare Excel, Word and PDF Files in Visual Studio Team Foundation Server 2010 […]

  2. Phil says:

    Hi there,

    When I use WinMerge I only get teh graphical blobs – not like the nice compare you have…. is there anything else I need to do?

    • Bernhard says:

      Then Xdocdiff plugin is not installed or registered correctly. Please take a close look to the installation guide of xdocdiff Plugin. Thanks

      • Phil says:

        Magic – The Unpacker wasn’t set to “Automatic” when loading WinMerge – Thanks for you help!!

  3. Miriam says:

    Great post; lean, clean, focused. It works.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: