Specify file type for comparison manually

GroupDocs.Comparison provides the option to specify file type for comparison manually.

To compare two documents and specify file type for comparison manually follow these steps:

  1. Instantiate the LoadOptions object. Specify the FileType.
  2. Instantiate the Comparer object. Specify the source document path or stream.
  3. Call the Add method. Specify the target document path or stream.
  4. Call the Comparer method.

The following code snippets show how to compare documents with a manually specified file type:

Compare documents from local disk and specify file type for comparison manually

using GroupDocs.Comparison;
using GroupDocs.Comparison.Options;
// ...

string sourcePath = @"source.docx";
string targetPath = @"target.docx";
string resultPath = @"result.docx";

// Create load options and set the file type
LoadOptions loadOptions = new LoadOptions();
loadOptions.FileType = FileType.DOCX;

using (Comparer comparer = new Comparer(sourcePath, loadOptions))
{
    // Add target document
    comparer.Add(targetPath, loadOptions);

    // Compare and save comparison result
    comparer.Compare(resultPath);
}