Compare multiple documents with specific compare settings
NOTE: This feature available only for Microsoft Word documents, Microsoft PowerPoint and Open Document presentations.
GroupDocs.Comparison allows to compare more that 2 documents and specify some specific comparison options like styling for detected changes, comparison detalisation level etc.
The following are the steps to compare multiple documents with specific options.
- Instantiate Comparer object with source document path or stream;
- Call Add method and specify target document path or stream. Repeat this step for every target document;
- Instantiate CompareOptions object and specify desired options;
- Call Comparer method and pass CompareOptions object from previous step.
The following code sample shows how to compare multiple documents with specific options.
Compare multiple documents with specific compare settings from local disk
using (Comparer comparer = new Comparer("source.docx")
{
comparer.Add("target1.docx");
comparer.Add("target2.docx");
comparer.Add("target3.docx");
CompareOptions compareOptions = new CompareOptions()
{
InsertedItemStyle = new StyleSettings()
{
FontColor = System.Drawing.Color.Yellow
}
};
comparer.Compare("result.docx", compareOptions);
}
Compare multiple documents with specific compare settings from stream
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"));
CompareOptions compareOptions = new CompareOptions()
{
InsertedItemStyle = new StyleSettings()
{
FontColor = System.Drawing.Color.Yellow
}
};
comparer.Compare(File.Create("result.docx"), compareOptions);
}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Comparison for .NET examples, plugins, and showcase
- GroupDocs.Comparison for Java examples, plugins, and showcase
- Document Comparison for .NET MVC UI Example
- Document Comparison for .NET App WebForms UI Modern Example
- Document Comparison for Java App Dropwizard UI Modern Example
- Document Comparison for Java Spring UI Example
Free Online App
Along with full-featured .NET library we provide simple, but powerful free Apps.
You are welcome to compare your DOC or DOCX, XLS or XLSX, PPT or PPTX, PDF, EML, EMLX, MSG and other documents with free to use online GroupDocs Comparison App.