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

Free Support Forum - aspose.com

Convert WPS Office Word Document to DOCX format using Java & Preserve Styles & Spacing between Lines

doc.zip (63.1 KB)
Hi, when i open the docx file(the attachment above) by using aspose.word for java and do nothing to it, then just save it to another docx file, but unfournately, the newly saved docx’s style is different with the original one(eg, line spacing and some others). please help!

Document document = new Document("/tmp/sdtdoc.docx");
document.save("/tmp/sdtdoc-copy.docx");

@gaols,

Thanks for your inquiry. Have you tried the latest version of Aspose.Words for Java i.e. 20.3 on your end? In case the problem still remains, please also ZIP and upload your output Word document and a screenshot showing the problematic area(s) in Aspose.Words generated DOCX file here for testing. We will then investigate the issue further on our end and provide you more information.

style-diff.zip (295.2 KB)
yes, even if the lastest version(eval version), the problem still the same. i’ve attached the generated docx file and two style diff pngs。

@gaols,

We have converted your “sdtdoc.docx” to DOCX format by using the licensed latest version of Aspose.Words for Java i.e. 20.3 and attached it here for your reference:

Do you still see the same problems in this output DOCX Word document?
What MS Word version are you viewing these files with? Or do you use OpenOffice Writer or any other editor?

Please also convert (Save As) “sdtdoc.docx” to PDF format and attach the PDF file here for our reference. Thanks for your cooperation.

the same problem. i’m using wps v11.1.0.9513-Release.

two pdf attached, one is the original docx’s pdf, the other pdf is the one converted from that you provided.

@gaols,

We tested the scenarios and have managed to reproduce the same problems on our end. For the sake of corrections, we have logged the following issues in our issue tracking system.

WORDSNET-20158: Table moves to next page during open save a DOCX
WORDSNET-20159: Vertical spacing between lines increases during open save a DOCX

We will further look into the details of these issues and will keep you updated on the status of corrections. We apologize for your inconvenience.

1 Like

@gaols,

Regarding WORDSNET-20159, it is to update you that we have completed the analysis of this issue on our end. Please see the analysis details below:

It is a known issue with pPrDefaults element missing in document produced by WPS Office. MS Word displays such documents depending on version and in this case, you need to explicitly specify version using LoadOptions.MswVersion.

Also, before 20.2 release of Aspose.Words, we had Word2007 version as default, and starting from 20.2 Aspose.Words, it now uses Word2013 version by default. If you want to see document as shown in MS Word 2013 by default, then please upgrade Aspose.Words to some of the latest versions. Hope, this helps.