NullReferenceException when saving a RTF file


I use the folowing code to load a RTF file using Aspose Words:

'Loading Aspose licence
Dim aAsposeWordsLicense As AsposeWords.License = New AsposeWords.License()

Dim mainDoc As AsposeWords.Document = Nothing

    mainDoc = New AsposeWords.Document("C:\temp\AWR.rtf")
Catch ex As Exception
    Dim m As String = ex.Message
End Try

This goes as expected and without problems. The problem occures when saving the loaded Document to a new file:


The Save routine causes a NullReferenceException although the “mainDoc” object looks okay. The only peculiar thing I noticed was that de “HasRevisions” and “PageCount” properties couldn’t be determined (both have a NullReferenceException when I use the Visual Studio quickwatch).
I have narrowed down the problem to the fact that the RTF file contains two tables inside another table. By the way, (Microsoft)Words has no problem opening the file.

I uploaded the RTF file as an attachment and I hope you can confirm the two-table construction is the actual problem.

Also, I would like to know how I can check if a loaded Document is corrupt or malformed so I can anticipate on a possible Save error.

Thanks in advance,


Btw, I use Aspose Words version 10.4.0.

Thanks for your request. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.
As a workaround, you can open/save your document using MS Word and then process using Aspose.Words.
Regarding check if a loaded Document is corrupted or malformed you can use try-catch statement.
Best regards,

The issues you have found earlier (filed as WORDSNET-5234) have been fixed in this .NET update and in this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.