Effect of Keep Different Styles Option on Builtin Normal & User Defined Styles | Merge Word Files using C# .NET

Using latest Aspose.Words dll, ImportFormatMode KeepDifferentStyles works differently, if style Normal is different (in two merge documents) versus any other style.
The following documents illustrate this:

  • TestMainNormal.docx has style Normal defined as Arial Narrow, 14 pt. All document body text in Main use this Normal style.
  • TestPartNormal.docx has style Normal defined as Arial Narrow, 8 pt. All document content in Part use this Normal style.
    As the Part document is appended to the Main by Aspose, it should create new style Normal_0 (Arial Narrow, 8 pt) and use it for all content from Part document. But that is not the case: the Part content uses Normal style from Main, resulting Arial Narrow 14 pt formatting.
    For any other style but Normal the behavior is different. By testing with documents TestMainTestStyle.docx and TestPartTestStyle.docx you can see that after appending Part to Main, content from Part is formatted as Arial Narrow 8 pt, as expected.

This KeepDifferentStyles behavior for Normal style has changed at some point. Using Aspose Words 15.5 it works consistently regardless of style. In Aspose Words 20.1 handling of Normal style differences is broken, as described above.
Sample documents.zip (63.8 KB)
Sampleapp.zip (624 Bytes)

@Aiddo,

The KeepDifferentStyles option only copies styles that are different from those in the source document. It allows to reuse destination styles if the formatting they provide is identical to the styles in the source document. If the style in destination document is different from the source then it is imported.

You’re right, content of TestPartNormal.docx should be formatted with Arial Narrow 8 points size Font in final document. The behavior should be same for builtin and user defined styles. We have logged this problem in our issue tracking system with ID WORDSNET-20912 and will keep you updated here on the status of linked issue. We apologize for your inconvenience.

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