GroupDocs.Comparison at a glance

API to compare differences between documents in .NET applications

Illustration comparison

File comparison in C#

Detect differences between source and target files for changes at paragraphs, words, and character levels. Identify styling and formatting changes like bold, italic, underlines, strike-troughs, font types, etc.

Most popular file and document formats are supported

GroupDocs.Comparison API allows for efficient document comparison across a wide range of formats, including PDF, HTML, emails, Microsoft Office documents (Word, Excel, PowerPoint, OneNote, Visio), various image types (JPEG, PNG, GIF, BMP), text files, and more.

Apply or reject changes easily

Each difference identified in the compared documents using the GroupDocs.Comparison API can be selectively applied or rejected, enabling customization before exporting to the final output document.

Comparison summary report

Generate a summary report of differences, detailing all the changes found in the compared documents, and save it for reference.

Platform independence

GroupDocs.Comparison for .NET supports the following operating systems, frameworks and package managers

Amazon
Docker
Azure
VS Code
ReSharper
macOS
Linux
NuGet

Supported file formats

GroupDocs.Comparison for .NET supports operations with the following file formats.

Microsoft Office & OpenDocument formats

  • Word: DOCX, DOC, DOCM,DOT, DOTM, DOTX, RTX, RTF, TXT
  • Excel: XLSX, XLS, XLT, XLTM, XLSB, XLSM
  • PowerPoint: PPTX, PPT, POT, POTX, PPS, PPSX
  • Outlook: EML, EMLX, MSG
  • OneNote: ONE
  • OpenDocument: ODT, ODP, OTP, ODS, OTT
  • Fixed Page Layout: PDF

Images, Graphics & Diagrams

  • Raster images: BMP, GIF, JPG, JPEG, PNG
  • Medical Imaging: DICOM
  • Microsoft Visio: VSDX, VSD, VSS, VST, VDX
  • AutoCAD Drawing: DWG, DXF

Other

  • Text: TXT
  • Programming Languages: CS, Java, CPP, JS, PY, RB, PL, ASM, GROOVY, JSON, PHP, SQL, LOG, DIFF, LESS, SCALA
  • Web: HTM, HTML, MHT, MHTML
  • e-Books: MOBI, DjVu
  • Delimiter-Separated Values: CSV

GroupDocs.Comparison features

Easily compare PDF and Office documents, images and other formats

Feature icon

Easy to use document comparison

Aanalyze and identify differences between two documents.

Feature icon

Compare multiple documents

Simultaneously analyze and identify differences across multiple documents.

Feature icon

Supported formats

Compatible with over 50 widely-used document formats from various categories, ensuring broad applicability.

Feature icon

Accept or reject changes

Сlear visual display of detected changes, complete with options to either accept or reject these modifications.

Feature icon

Generate previews

Ability to save comparison results as image previews for easy reference and sharing.

Feature icon

Content comparison

Conduct thorough text comparisons at various levels - including line-by-line, paragraph, word, and character - with highlighted differences for better clarity.

Feature icon

Style and formatting comparison

Detects and highlights alterations in document formatting and style, ensuring comprehensive review.

Feature icon

Flexible metadata settings

Preserve metadata from source or target files, or customize it according to user preferences.

Feature icon

Password protection

Analyze password-protected documents and secure the output document with password encryption for added security.

Feature icon

Selective page comparison

Load and compare specific sections or pages of a document for targeted analysis.

Feature icon

Display comments

Choose to display or hide comments when loading the source document, offering greater control over the comparison process.

Code samples

Some use cases of typical GroupDocs.Comparison for .NET operations

Comparing password-protected documents.

To compare documents that are protected with a password, you need to specify it then loading the documents:

How to compare password-protected documents.

// Load the source document and specify its password
using(Comparer comparer = new Comparer("source.docx", new LoadOptions() {Password = "1234"}))  
{
    // Load the target document and specify its password
    comparer.Add("target.docx", new LoadOptions() {Password = "5678"});

    // Save comparison result to a specified file
    comparer.Compare("result.docx");
}

Comparing multiple PDF documents.

GroupDocs.Comparison allows you to compare more than two documents. The operation is almost the same as when comparing two files. You just need to add more target files to the comparer class.

How to compare three or more documents.

// Load the source document
using(Comparer comparer = new Comparer("source.docx") 
{
    // Specify the second file for comparison
    comparer.Add("target2.docx");
    
    // Specify the third file for comparison
    comparer.Add("target3.docx");
    
    // Save comparison result to a specified file
    comparer.Compare("result.docx");
}
 English