Font size changes when merging documents

I have a blank template document and then I appended two documents to it (basically to merge these two documents) using
Document.AppendDocument(srcDoc, ImportFormatMode.KeepSourceFormatting);

The source document uses Times New Roman size 12. The same section in the final merged document is showing up as Times New Roman size 10. If I’m using KeepSourceFormatting, what could be causing the font to change to size 10?

thanks,

Hi Beata,


Thanks for your inquiry. Please note that Aspose.Words tries to mimic the same behavior as MS Word do. The ImportFormatMode specifies how formatting is merged when importing content from another document.

When using the UseDestinationStyles option, if a matching style already exists in the destination document, the style is not copied and the imported nodes are updated to reference the existing style.

The drawback of using UseDestinationStyles is that the imported text might look different in the destination document comparing to the source document. For example, the “Heading 1” style in the source document uses Arial 16pt font and the “Heading 1” style in the destination document uses Times New Roman 14pt font. When importing text of “Heading 1” style with no other direct formatting, it will appear as Times New Roman 14pt font in the destination document.

Using the KeepSourceFormatting option allows to make sure the imported text looks in the destination document exactly like it was in the source document. If a matching style already exists in the destination document, the source style is copied and given a unique name by appending a suffix number to it, for example “Normal_0” or “Heading 1_5”.

The drawback of using KeepSourceFormatting is that if you perform several imports, you could end up with many styles in the destination document and that could make using consistent style formatting in Microsoft Word difficult for this document.

In case you are using an older version of Aspose.Words, I would suggest you please upgrade to the latest version (v13.2.0) from here and let us know how it goes on your side. If the problem still remains, please attach your Word documents here for testing. I will investigate the issue on my side and provide you more information.