Show gap lines instead of changes


GroupDocs.Comparison allows adjusting formation of the resulting document.

By default, changes from the two input files (source and target files) are added to the resulting document and visually highlighted. This can be configured using the ShowInsertedContent and ShowDeletedContent properties.

You can also use the LeaveGaps property to adjust the display of the resulting document, which allows to replace changed content with empty lines. To use this property, you also need to activate the following properties: ShowInsertedContent and ShowDeletedContent.

Here are the simple steps to get the above result:

Example code block to get the desired result


using (Comparer comparer = new Comparer(sourcePath))
{
    comparer.Add(targetPath);
 
    CompareOptions options = new CompareOptions();
    options.ShowInsertedContent = false;
    options.ShowDeletedContent = false;
    options.LeaveGaps = true;
      
    comparer.Compare(resultPath, options);
}

Example code execution


Default resultResult without LeaveGaps property
Default resultResult with LeaveGaps property

More resources


GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

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.