Compare multiple documents
NoteThis feature is available only for Word documents, PowerPoint and Open Document presentations.
GroupDocs.Comparison allows you to compare more that two documents.
To compare several documents, follow these steps:
- Instantiate the Comparer object. Specify the source document path or stream.
- Call the Add method and specify target document path or stream. Repeat this step for every target document.
- Call the Compare method.
The following code snippets show how to several documents:
using (Comparer comparer = new Comparer("source.docx")
{
comparer.Add("target1.docx");
comparer.Add("target2.docx");
comparer.Add("target3.docx");
comparer.Compare("result.docx");
}
The result is as follows:
using (Comparer comparer = new Comparer(File.OpenRead("source.docx"))
{
comparer.Add(File.OpenRead("target1.docx"));
comparer.Add(File.OpenRead("target2.docx"));
comparer.Add(File.OpenRead("target3.docx"));
comparer.Compare(File.Create("result.docx"));
}