Hello All,
We are using DocParts to generate content for Aspose.Words mail merge. Within the DocParts, we utilize Word’s Outline/Navigation feature, applying built-in heading styles (e.g., Heading 1, Heading 2) to enable collapsible sections for better document structure.
However, when we insert these DocParts into our template and generate the final document using our algorithm, we’re encountering formatting inconsistencies:
- The font color changes from black (as defined in the DocPart) to blue.
- The font style changes from Arial to Aptos (Body).
We want to preserve the original formatting defined in the DocPart (including font family, size, and color) and prevent any automatic style overrides during document generation.
Attaching screenshot for your reference
@Vaibhavi_Lad Could you please attach your sample template and data that will allow us to reproduce the problem? We will check the issue and provide you more information.
As I can see from the provided screenshot you are using LINQ Reporting Engine, not Mail Merge feature.
Yes, We are using LINQ Reporting Engine only. So
this is the docpart which I am using
docpart.docx (24.6 KB)
in below template
aspose.docx (14.3 KB)
in our system we are using docpart as above in template then using
data.docx (18.0 KB)
as data/json for generating document while doing that I am getting
output.docx (15.9 KB)
We are using the LINQ Reporting Engine provided by Aspose.Words.
- We have a reusable content part file: docpart.docx
- This docpart is included in our main template: aspose.docx
- During document generation, we use data defined in: data.docx (converted to JSON or mapped accordingly)
- However, the final generated output: output.docx does not produce the expected results.
We are inserting the docpart into the main template using the LINQ tag syntax
@Vaibhavi_Lad Thank you for additional information. The problem occurs because by default, while inserting content of an outer document, the engine applies corresponding styles of a template document. This makes content of a result document look more consistent. However, you can keep source formatting for content being inserted by using a sourceStyles
switch. Please try modifying your template like this:
<<doc [DocPart_test_aspose] -build -sourceStyles>>