Compare Excel, Word and PDF Files in SharePoint
29. April 2012 Leave a comment
Now I want to show, how you can compare Office documents stored in SharePoint. Sometimes you need to see the differences of two documents that maybe having the same name and are on two different places in SharePoint. Or if version control is enabled on your site and you want to see what recently has been changed in your document.
How Office Documents can be compared?
I’m using WinMerge in combination with xdocdiff Plugin. I have already written something about the topic in my previous post:
Please, read this before you continue here. Especially capter 1 and 2 are important.
Using WinMerge with SharePoint
It is not possible to insert an url in WinMerge to compare documents directly. Of course you can compare the documents in WinMerge by downloading the files to your local machine and compare them using WinMerge manually.
Saving the files locally and comparing them is a time consuming task. If you need that just a few times in the year, the procedure is ok. If you want to do this more often, you can use my tool.
Sharepoint File Compare – The Tool
The tool can compare Office documents in SharePoint more comfortable.
Features:
- Enter the url directly into the UI
- Displays the versions of the SharePoint file
- Enables you to select a version by double-click on the grid
- Downloads the files and opens WinMerge to compare them automatically
Software Requirements:
- .NET Framework 4.0 Client Profile must be installed
How to use the Tool
The tool is just a single dialog where you can enter the files you want to compare.
1. Download Sharepoint File Compare
You can download Sharepoint File Compare from here…
http://dl.dropbox.com/u/40751518/CodeSamples/SharepointFileCompare-0.8.zip
2. Start Sharepoint File Compare
The first time you need to choose the location of WinMergeU.exe. The default location of WinMerge is:
"C:\Program Files\WinMerge\WinMergeU.exe"
You can change the path to WinMergeU.exe every time later. On the bottom right of the main window you will find this button.
3. Comparing two Files
3.1 Insert the Left
First you should enter the first SharePoint url to the Left text box. Version history is loaded automatically and shown in the grid.
3.2 Select the Right from Version History
Double-click on a version history item will select use the item for Right text box.
3.2 Insert the Right
You do not need the version history, you can add every file url manually in the Right text box.
3.4 Click Compare
Downloads the files locally and opens WinMerge.
Interesting Notes for Developers
The source code is included in the download above. It contains very interesting things for starters and advanced developers.
- Web Service Authentication using NetworkCredential done with background threading and synchronization.
- CredUIPromptForWindowsCredentials pinvoke sample to show the windows built-in security dialog
- A very basic MVVM implementation without using a framework
- Anchor and docking using WPF
- Asynchronous operations with multi-threading using System.Threading.Tasks namespace and an very interesting (background) Activity class implementation that simplifies background threading and synchronization in WPF.
- SharePoint Web Services usage is shown: Webs.asmx, Versions.asmx
Maybe for some of this points I will write another blog posts from a more technical perspective.













