We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

[.Net] Exception on comparing RTF documents


we noticed an issue on comparing rtf documents. When calling the Compare method an unhandled NullRefefenceException is thrown. As we internally tried to find out if we make something wrong or not we were able to reduce the scenario as following:
If the original document ends with a table, the exception is thrown. If there is any kind of text after the table, everything is working fine. If you try to reproduce the issue with the attached example files and the following snippet, it is important to set a license as otherwhise there automatically is that trial notification text appended.

file old.rtf: the old revision
file old text.rtf: an alternative version of the old revision which has text after table
file.rtf: the new revision

Code to reproduce the isse:

var lic = new License();

var doc_old = new Document(@"S:\tmp\file old.rtf"); // you may replace this with "file old text.rtf" to check the behaviour if there is text after the RTF table
var doc_new = new Document(@"S:\tmp\file.rtf");

doc_old.Compare(doc_new, "Name", DateTime.Now);

files.zip (3.2 KB)

Kind Regards,


Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-17106. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

1 Like

The issues you have found earlier (filed as WORDSNET-17106) have been fixed in this Aspose.Words for .NET 18.8 update and this Aspose.Words for Java 18.8 update.