Preserve Paragraph Spacing Before/After - WPS Office Document Processing

Problem

I saved a docx document directly and found that the paragraph space was automatically set to 10. I did nothing.

Code

var doc=new  Aspose.Words.Document(@"C:\Users\XCL\Desktop\源文件.docx");
doc.Save(@"C:\Users\XCL\Desktop\tttt\out.docx",SaveFormat.Docx);

I used compatibility mode and I had the same problem:

var doc=new  Aspose.Words.Document(@"C:\Users\XCL\Desktop\源文件.docx");
doc.CompatibilityOptions.OptimizeFor(Aspose.Words.Settings.MsWordVersion.Word2016);
doc.Save(@"C:\Users\XCL\Desktop\tttt\out.docx",SaveFormat.Docx);

Version

Aspose.Words.dll 18.4

@xucongli1989,

It seems that the issue occurs because the default paragraph properties of the document are missing. MS Word adds values depending on version. The following code fixes the issue:

LoadOptions lo = new LoadOptions();
lo.MswVersion = MsWordVersion.Word2013;

Document doc = new Document("E:\\206490\\in.docx", lo);
doc.Save("E:\\206490\\aspose.words-19.12.docx");

I try it again. But it changes 10 to 8, and I tried other Word versions, the same problem.

My code

	Aspose.Words.LoadOptions lo = new Aspose.Words.LoadOptions();
	lo.MswVersion = MsWordVersion.Word2013;
	var doc=new  Aspose.Words.Document(@"C:\Users\XCL\Desktop\源文件.docx",lo);
	//doc.CompatibilityOptions.OptimizeFor(Aspose.Words.Settings.MsWordVersion.Word2013);
	doc.Save(@"C:\Users\XCL\Desktop\tttt\out.docx");

Image

image.jpg (331.4 KB)

Version

19.12 from nuget

@xucongli1989,

We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-19688. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

@xucongli1989,

Regarding WORDSNET-19688, please also tell us what version of MS Word you are using on your end to obtain the results similar to what is shown in the image-input-file-preview.jpg (226.8 KB). We see that the value of “space after” is zero in this image. However, MS Word 2013, 2016 and 2019 all show 8 pt and 10 pt in MS Word 2007 and 2010 on our end. Thanks for your cooperation.

The issues you have found earlier (filed as WORDSNET-19688) have been fixed in this Aspose.Words for .NET 20.5 update and this Aspose.Words for Java 20.5 update.