Free Support Forum - aspose.com

Loading RTF with Aspose.Words Error

Hi,

I'm trying to open a RTF (see attached) file with Aspose.Words 4.2.3.0 but I get the following error:

An unhandled exception of type 'Aspose.Words.FileCorruptedException' occurred in aspose.words.dll

Additional information: The document appears to be corrupted and cannot be loaded.

The file can be opened with Microsoft Word, I tried with the latest release of Aspose.Words but the error persists.

Here is the code:

Try

Dim license As Aspose.Words.License = New Aspose.Words.License

license.SetLicense("Aspose.Words.lic")

Catch ex As Exception

End Try

Dim doc As Aspose.Words.Document

doc = New Aspose.Words.Document("c:\2007TA1765.rtf")

'or

'doc = New Aspose.Words.Document("c:\2007TA1765.rtf", Aspose.Words.LoadFormat.Rtf, "")

Can You please help me.

Claudio

Hi

Thank you for your reporting this to us. I managed to reproduce the problem. I created an issue #4095 in our defects database and we will investigate whether and when it can be fixed. Please expect a reply before the next hotfix (within 2-3 weeks).

Best regards.

This RTF is invalid (RTF is nested inside RTF). If you can fix this in the document it will be a workaround that will allow you to proceed.

Since MS Word reads this RTF ok, I've made Aspose.Words to read it okay too. Will be available in the next release.

We have released a new version of Aspose.Words that contains a fix for your issue.

issue #4095 - “Aspose.Words.FileCorruptedException” exception occurs during opening RTF document.

The new version of Aspose.Words is available for download from here.

Best regards.