Conversion from docx to doc problem

Hi,

we are using Aspose Words.NET to generate some documents. We are having problems with docx files sometimes using the wrong line spacing, leaving us with documents that do not look the way they’re supposed to. We could not figure out why this was happening, we have a base doc template with sections in which we put some other templates (all of them are DOC, not DOCX) and we put a user’s DOC or DOCX file. Most of the DOCX we try to put in cause the whole document to change line spacing, making it look broken. As we couldn’t find a way for this to not happen (the only docx in the whole merge process was put in using ImportNode and adding the node, tried using both KeepSourceFormatting and UseDestinationStyles), we decided we could just always convert the DOCX to a DOC and not have the problem, as DOC never changes the line spacing.
So, we put in this code:

// Load user document from fileStream
Aspose.Words.Document user = new Aspose.Words.Document(userFileStream);
userFileStream = null; // added when didn't work without, but didn't change the result
userFileStream = new MemoryStream();
user.Save(userFileStream, SaveFormat.Doc); // force saving to filestream as DOC
user = null; // same as userFileStream = null;
user = new Aspose.Words.Document(userFileStream); // create new user document from the (what should be) DOC generated from the DOCX

we expected this to work as DOC always works, but it didn’t, so we put in a save to file as doc after this code snippet and realized that the DOC isn’t the same DOC that word generates when saving DOCX to DOC.

This causes our document to have a “broken” look.

Attached are four files:

  • Start_docx.docx which is the starting point document(it’ s just a regular docx created in Word 2007)
  • Start_doc-saved_through_word.doc which is the DOC that was created by opening Start_docx.docx in Word and pressing Save as and choosing doc instead of docx
  • aspose_convert.doc which is the result of the save to file after the conversion using Aspose Words that I mentioned earlier
  • aspose_convert-saved_through_word.doc which is the aspose_convert.doc opened in Word and saved to a new DOC file using the same method used to save the Start_doc-saved_through_word.doc file

From the file sizes it looks like the aspose_convert.doc is not different from Start_docx.docx suggesting there weren’t any changes, however, opening both files in an archive manager suggests that the conversion “succeeded”, but Start_doc-saved_through_word.doc has a much larger size indicating that the conversion may not have succeeded correctly.

If this is not a bug, why does the line spacing get changed to Word 2007 style when the base document in which the user document is inserted?

Thank you and best regards

Hi
Thanks for you request. First of all, as I can see you are using old (9.2.0) version of Aspose.Words. There was a fix of a similar issue in 9.3.0 version. So please try using the latest version of Aspose.Words and let me know if the problem still persists. You can download the latest version from here:
https://releases.aspose.com/words/net
Also, is I understand you properly, the problem occur only when you append DOCX document to your master document. Am I right? If so, could you please also attach your master document here for testing? I will try to reproduce the problem on my side and provide you more information.
Best regards,

Thank you, I will try using the newest version.

No, the master document is always the same DOC file with a few sections that get filled from different templates, and a single section that gets filled from a user document.

Hi
Thank you for additional information. Could you please attach your master documents and sample output that will demonstrate the problem? Or just create a simple application that will allow us to reproduce the problem.
Best regards,

I’ ve just tried with the latest Aspose Words.NET and the problem is gone.Thank you very much for your help!

If you still need the documents I can try to upload something (can’t upload them directly as they are confidential, part of them at least), however, changing to the 9.7.0 seemed to have fixed the problem with the line spacing, even without converting to DOC first.

Thank you very much and best regards!

Hi
It is perfect that the problem is resolved. No, the documents are not required if the problem does not occur anymore.
Best regards,