Table formatting skewed after conversion to DOCX from RTF

I am using version 16.7.0.0 of Aspose.Words. For a client project I have built a tool to extract RTF documents stored in their Oracle database to physical files and then convert them to DOCX. The original templates were built using Office 97. The current template has been through its share of updates, but the earliest extracted documents would have been using Office 97.

Another application uses Aspose to generate new documents from these templates in DOCX format. This application is working as expected and the documents have no issues. However, with these older documents, there have been severe formatting issues once they are converted. The issues affect the table formatting and the page margins. I have attached the original document as extracted from the database (with a .doc extension, though it has been tested with .rtf and the results are the same) and the converted document. Opening the extracted document in Word (tested with versions 2010, 2013, and 2016) and then saving as a DOCX works, the document formatting is not affected.

The code I am using to perform this conversion is as follows:

Stream strmRTFInput = File.OpenRead(strFilePath + strFileName);

LoadOptions loDocConvert = new LoadOptions();
loDocConvert.LoadFormat = LoadFormat.Rtf;

awDocument = new Document(strmRTFInput, loDocConvert);

strNewFileName = strFileName.Replace("doc", "docx");

awDocument.Save(strFilePath + strNewFileName, SaveFormat.Docx);

strmRTFInput.Close();

This code is identical to the code used in the document generator which is working fine. It seems to only be an issue with these older documents. In addition to the above I have tried various compatibility options but none have affected the output.

For the moment I’ve had to switch the application back to using Word interop to perform the conversion but this is much slower. I’d prefer to be able to use the control for this application to increase the speed as there is a very large number of documents to convert.

Hi Shane,

Thanks for your inquiry. 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-14440. 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-14440) have been fixed in this Aspose.Words for .NET 24.3 update also available on NuGet.