Appending Document changes font in footer

We have documents that are premade with fields for data and we use the Document.MailMerge() method to load the form with data and then append to another document.

The footer text is Arial size 10 font but when appended, Aspose.Words changes it to Times New Roman size 12. It seems to be somewhat random too because it doesn’t always do the same documents. I have reversed the order of how the documents are appended and had different results.

I am using the latest release version 22.11.0 of Aspose.Words
in Visual Studio 2022 v.17.4.0

Please let me know what additional information I can provide.

Thanks!

@kingdona82 Could you please attach your source documents and the output document for our reference? We will check the issue and provide you more information.

Hi – Thank you for the response. Please find files attached.

NLI53.docx – This is the first template document. It is appended first to a new Aspose Document object.

NLI54A.docx – This is the second template document that has the form ID in Arial 10 inside the footer. It has one merge field ais appended to the same Document object as NLI53.docx.

output.docx – This is the document where data has been merged into both documents and appended. This is where we see the footer font changed to Times New Roman 12 in the NLI54A.docx document.

Please let me know if I can provide any additional information.

Thanks!

Don

NLI54A.docx (20.5 KB)

output.docx (15.7 KB)

NLI53.docx (18.8 KB)

@kingdona82 Thank you for additional information. I have managed to reproduce the problem on my side. For a sake of correction it has been logged as WORDSNET-24612. We will keep you informed and let you know once it is resolved.
As a workaround, you can try using ImportFormatMode.KeepDifferentStyles:

Document doc1 = new Document(@"C:\Temp\NLI53.docx");
Document doc2 = new Document(@"C:\Temp\NLI54A.docx");
doc1.AppendDocument(doc2, ImportFormatMode.KeepDifferentStyles);
doc1.Save(@"C:\Temp\out.docx");

The workaround works for me. Thanks!

1 Like

@kingdona82 The issue is considered as Not a Bug.
Aspose.Words mimics MS Word’s behavior by default. To get different result than in Word, you should use ImportFormatOptions, as the following:

ImportFormatOptions options = new ImportFormatOptions { IgnoreHeaderFooter = false };
doc1.AppendDocument(doc2, ImportFormatMode.KeepSourceFormatting, options);

The issues you have found earlier (filed as WORDSNET-24612) have been fixed in this Aspose.Words for .NET 23.9 update also available on NuGet.