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

Free Support Forum - aspose.com

Document.Compare throws exception Unable to cast object of type 'Aspose.Words.Run' to type 'Aspose.Words.SpecialChar' using .NET

Hi,

we get an System.InvalidCastException when comparing two documents:

An unhandled exception of type 'System.InvalidCastException' occurred in Aspose.Words.dll

Additional information: Das Objekt des Typs "Aspose.Words.Run" kann nicht in Typ "Aspose.Words.SpecialChar" umgewandelt werden.

Example code

        static void Main(string[] args)
        {
            var lic = new License();
            lic.SetLicense(@"S:\Aspose.Total.lic");

            var doc = new Document(@"S:\tmp\old.doc");
            doc.Compare(new Document(@"S:\tmp\new.doc"), "test", DateTime.UtcNow);
        }

Files are attached.

Kind regards,
Daniel

documents.zip (86.4 KB)

@Serraniel

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-19781. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

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