I use the folowing code to load a RTF file using Aspose Words:
'Loading Aspose licence Dim aAsposeWordsLicense As AsposeWords.License = New AsposeWords.License() aAsposeWordsLicense.SetLicense("Aspose.Words.lic") Dim mainDoc As AsposeWords.Document = Nothing Try 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.