Pages of document are increased and contents are messed up are re-saving DOCX using .NET

Hi, Support:

I found a bug:
For the test.docx, it display one page in MS Word,where opened by Words.dll and then save, then re-open the resaved doc by MS Word, it display 2 pages and the format has been messed up. Why? what’s wrong?
Test.zip (333.7 KB)

@ducaisoft

We have tested the scenario using the latest version of Aspose.Words for .NET 20.9 and have not found the shared issue. So, please use Aspose.Words for .NET 20.9.

I try the V20.9,but the issue is still on in my end.

@ducaisoft

Could you please share the following resources here for further testing?

  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please share your working environment e.g. operating system, .NET version etc.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

please refer to the attachments.
‘Input.doc’ is the doc for testing.

‘Input display in Word2010.doc’ is what the ‘Input.doc’ displayed in Word2010.

‘Input display in Word2003.doc’ is what the ‘Input.doc’ displayed in Word2003.

I use Words.dll v20.9 based on VB.net 2008 and Net3.5 and on WinXP3 to open the ‘Input.doc’, the dll report the pagecount is 2, while I use MS Word 2003 on WinXP3 to open the ‘Input.doc’, the MS Word 2003 show the pagecount is 2.

whereas:

I use Words.dll v20.9 based on VB.net 2008 and Net3.5 and on Win10 to open the ‘Input.doc’, the dll report the pagecount is 2, while I use MS Word 2010 on Win10to open the ‘Input.doc’, the MS Word 2010 show the pagecount is 1.

what’s wrong with different Word version on the same doc?

Test.zip (333.7 KB)

@ducaisoft

Please make sure that the fonts used in your document are installed on the system where you are using Aspose.Words’ code to get the page count and viewing the Word document in MS Word 2010.

You can use LoadOptions.MswVersion property to specify that the document loading process should match a specific MS Word version. Please check the following code example.

    Dim loadOptions As Aspose.Words.LoadOptions = New Aspose.Words.LoadOptions()
    loadOptions.MswVersion = MsWordVersion.Word2010
    Dim doc As Document = New Document(MyDir & "Test.docx", loadOptions)
    Console.WriteLine(doc.PageCount)

Yes! This issue caused by mismatched font in different system.
And else, could the words.dll auto detect the font installation status and adjust the font and format to keep their original ?

@ducaisoft

You can get the missing fonts notification while saving document to fixed page format by implementing IWarningCallback interface. Please refer to the following article.

How to Receive Notification of Missing Fonts and Font Substitution during Rendering

Please note that Aspose.Words mimics the behavior of MS Word. Every font has particular size, weight and style of a typeface. So, pages of MS Word document may different for same content.