Dear Team,
I am currently utilizing the Aspose Mail Merge mechanism, and I’ve encountered an issue where, for a specific value, the font family changes unexpectedly. Specifically, when the value “µL/bee” is inserted into the document, it is replaced with the Times New Roman font, even though the rest of the document is consistently using the Arial font.
This issue only occurs for this particular value, and all other instances of mail merge work as expected. Could you please help me identify the root cause of this behavior and suggest a potential solution?
I hereby attach the sample document for your reference.
Error Doc.docx (13.7 KB)
@KeerthanaRamesh214
Based on limited evidence (treat as hypothesis), here is a cautious take:
Summary
When the merge inserts the string “µL/bee” the resulting text appears in Times New Roman while the rest of the document uses Arial. This usually occurs when the font applied to the run cannot render one of the characters, causing Aspose.Words to fall back to another font.
Possible reasons
- Missing glyph in the primary font – If the font assigned to the merge field does not contain a glyph for a character (e.g., the micro‑sign µ), the engine substitutes a different font.
- Run‑level formatting – The merge field or the surrounding style may have an explicit font assignment that overrides the document‑wide default when a fallback occurs.
Steps to resolve
-
Verify the template – Open the DOCX in Microsoft Word, select the merge‑field placeholder, and confirm that its Font property is set to Arial (or “Default”). Remove any direct formatting that forces Times New Roman.
-
Check Word’s font‑substitution settings – In Word go to File → Options → Advanced → Font Substitution and map a suitable substitute (e.g., Arial) for any missing glyphs.
-
Use a font that contains the required glyph – Replace Arial with a font that is known to include the µ character (e.g., Arial Unicode MS) and embed that font in the document (Word → File → Options → Save → Embed fonts).
-
Force the desired font after the merge – After doc.MailMerge.Execute(...) you can iterate over the runs that contain the problematic text and set the font explicitly:
foreach (Run run in doc.GetChildNodes(NodeType.Run, true))
{
if (run.Text.Contains("µL/bee"))
run.Font.Name = "Arial";
}
This guarantees that the run uses the intended font regardless of any fallback.
- Provide diagnostic information if the issue persists – Record the Aspose.Words for .NET version, a minimal reproducible template, and the exact code snippet. Supplying these details to Aspose support helps pinpoint any SDK‑specific behavior.
Checklist
- [ ] Confirm the merge‑field’s font in the template is Arial.
- [ ] Review and adjust Word’s font‑substitution table.
- [ ] Test the merge with a font that definitely contains µ.
- [ ] Apply a post‑merge run‑level font fix if needed.
- [ ] If the problem remains, prepare a minimal sample and version info for further assistance.
Please validate this behaviour with your exact SDK version and a minimal repro, as support can vary by release.
Assumptions / confirmations needed: SDK + version, file types, minimal sample, and exact error/output.
@KeerthanaRamesh214 Unfortunately, I cannot reproduce the problem on my side using the following simple code:
JsonDataSource ds = new JsonDataSource(@"C:\Temp\data.json");
Document doc = new Document(@"C:\Temp\in.docx");
ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, ds, "Sample");
doc.Save(@"C:\Temp\out.docx");
Here is the test JSON data used for testing:
{
"Sample": {
"Name": "20",
"Value": "µL/bee"
}
}
Here is the produced output: out.docx (10.8 KB)
As I can see font formatting is properly preserved in the produced output.