Font issues when updating TOC in mail merge using C#

When I use mail merge using Aspose using font “Gill sans” , when updating TOC table , some of the components have the wrong number in the table .

@shaheerwagih Can you please provide the template file and a code snippet to help us replicate your issue?

@shaheerwagih The problem might occur because the fonts used in your document are not available on the machine where document is processed. Please note Aspose.Words needs the fonts used in the document to build document layout upon updating TOC. If Aspose.Words cannot find the font used in the document, the font is substituted . This might lead into fonts mismatch and document layout differences due to the different fonts metrics, this in turn can cause incorrect page numbers in the TOC. You can implement IWarningCallback to get notifications when font substitution is performed.

FYI @eduardo.canal

1 Like

@alexey.noskov Thank you for the tip and I have already done that and there is font substition happening and I have selected the default font to be Arial but even with that the issue is still present .

@eduardo.canal I work with a product with 3 Million line of code and getting a snippet where I use Aspose is not an easy task to do .

I have a license with order ID 221107015909

what can I do to get to get someone to help me on a call ?

@shaheerwagih

what can I do to get to get someone to help me on a call?

I apologize for any confusion. However, this support platform is primarily designed to assist users through written communication. We are unable to provide individual support through alternative means such as phone calls or remote sessions.

If you’re unable to provide a code snippet, that’s understandable. However, it would be helpful to receive a sample of the template you are using. This will enable us to replicate your issue and provide you with the necessary support.

@eduardo.canal I am performing mail merge on this template mail.merge.template.docx (156.8 KB)

and I set up the following font settings :
fontSettings.SubstitutionSettings.FontInfoSubstitution.Enabled = false;

when the mail merge is performed only one or 2 components have the wrong numbers .

another important notice is that if you have the font used in the template installed on your system it might not be reproducible

1 Like

@shaheerwagih Thank you for providing the additional information. I will review the files and attempt to reproduce the issue you described.

@shaheerwagih I have thoroughly tested the scenario you described but could not reproduce the issue, even after uninstalling the font from my computer. It is crucial to ensure that you call the UpdateFields method before saving the document, as it has proven to be effective in resolving similar cases. Kindly verify if this step has been included in your implementation. If the problem persists, please provide additional details or a sample code snippet so that we can further investigate and assist you better.
output.docx (141.0 KB)

I am using UpdateFields() indeed and also tried to follow it by UpdateListLabels() but the issue still persists .

here is a sample of the faulty behaviour document
Mail_Merge_Document.docx (149.1 KB)

you can find Attività: atti444 entry is at page 8 but when you click it , it’s actually on page 9

extra info : I am using windows OS so the FontConfigSubstition option won’t work on my OS .

@shaheerwagih
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-25506

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.