Compare Word Documents with NET REST API

This article describes how to compare Word documents with NET REST API. You will learn to compare Word files with C# Low Code API using the .NET cloud SDK. Complete program flow and a sample code are available to perform this task online.

Prerequisite

Steps Compare Two Word Docs with C# Low Code API

  1. Initialize the WordsApi object by setting the cloned ID and secret to compare the documents
  2. Read the latest Word file into the memory stream and upload it to the cloud storage
  3. Create the CompareData object and use the uploaded file as a reference
  4. Read the initial Word file into the memory stream
  5. Create the CompareDocumentOnlineRequest object by providing the initial Word file, updated Word file and the output file name
  6. Invoke the CompareDocumentOnline method and provide the request object
  7. Download the output Word file from the response and save it on the disk

The above steps describe how to compare Word docs online with C# Low Code API. Commence the process by uploading the latest Word file to cloud storage followed by creating the CompareData object using the uploaded document reference. Read the original file into the memory stream, create the CompareDocumentOnlineRequest with the uploaded Word file, local document with changes, and the output Word file and finally call the CompareDocumentOnline() method to compare the Word files.

Code to Compare Word Documents Online with NET REST API

This code demonstrates the process to compare differences between two Word documents with C# REST API. This code shows that first we upload the latest Word file into the cloud storage as a reference and read the previous version of the Word file locally to compare it with the reference Word file. In the CompareData class, there is a property named CompareOptions that supports the customization of the comparison such as ignoring case changes, comments, fields, footnotes, formatting, headers and footers, tables and text boxes.

In this topic, we have learned to compare two Word files. For deleting the comments in a Word file, refer to the following article: Delete Comments in Word DOC with NET REST API.

 English