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

Free Support Forum - aspose.com

Avoid Invalid Cast Exception during Comparing Word Document | C# .NET

When comparing 2 documents I am getting an exception - “Unable to cast object of type ‘Aspose.Words.Paragraph’ to type ‘Aspose.Words.Run’”. Attached is a sample program including the documents that causes the error.

CompareDocumentsTest.zip (241.5 KB)


You’re right; Aspose.Words for .NET currently throws following exception upon comparing these particular Word DOCX documents:

  Message=Unable to cast object of type 'Aspose.Words.Paragraph' to type 'Aspose.Words.Run'.

For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-22623. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

Is it possible to determine if there is anything specific I can do or avoid in my documents to prevent this error?


WORDSNET-22623 is currently pending for analysis and is in the queue. Once the analysis of this issue is completed and the root cause is determined, we will then be able to provide you more information. We apologize for any inconvenience.