We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Style changes when converting from docx to pdf

I have written a procedure that includes some docx in a main document. The included files styles are different from the main document styles.

The resulting document is ok: each file still looks like before the inclusion.

The problem is that after the conversion to pdf, the main document style overwrites the includes files styles, and the original layout is lost.

Here is the conversion code:

var convert = new Aspose.Words.Document(path);
convert.SaveToPdf(path.Replace(".docx", ".pdf"));

See attached the layout in the docx and in the pdf files.

Kind regards

Roberto

Hello Roberto,

Thanks for your inquiry. Could you please attach your input and output documents here for testing? I will investigate the problem on my side and provide you more information.

Also, as I can see you use some old version for testing. Please try using the latest version of Aspose.Words (9.4.0) and let me know how it goes on your side. You can download this version from here:

http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1188.aspx


Best regards,

Thank you for your support,

in the attached file you can find:

  • the input files (main document and included document) that generate the docx output file
  • the output files: docx and its pdf conversion

I' ll try your code and I' ll let you know

Regards

Roberto

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I cannot reproduce the problem on my side using the latest version of Aspose.Words (9.4.0).

Best regards,

That means that your pdf has the same layout as the docx using the code lines I have provided?

In that case, could you please attach your result?

Thank you

Roberto

Yes, of course, please see the attached document.

Best regards,

I confirm that it works with the new version.

Kind regards

Roberto