our client reported 4th merge issue...
They try to merge a template with a calculation and get System.InvalidOperationException: 'Cannot find any fonts in specified font sources.
I took some time to research and found that the issue was introduced with 8.8.0 and is also present in the latest Spire. Previous versions look fine. Here is my code:
- Code: Select all
var data = new DataTable();
data.Columns.Add(new DataColumn("Investor_Fiscalyearend", typeof(DateTime)));
data.Columns.Add(new DataColumn("Investor_Name", typeof(string)));
data.Columns.Add(new DataColumn("Investor_Sum1", typeof(int)));
data.Columns.Add(new DataColumn("Investor_Sum2", typeof(int)));
data.Columns.Add(new DataColumn("Investor_Sum3", typeof(int)));
data.Columns.Add(new DataColumn("Investor_Referralfee", typeof(int)));
var r = data.Rows.Add();
r["Investor_Name"] = "IA1";
r["Investor_Fiscalyearend"] = DateTime.Now;
r["Investor_Referralfee"] = 25;
r["Investor_Sum1"] = 100;
r["Investor_Sum2"] = 200;
r["Investor_Sum3"] = 300;
foreach (DataRow dr in data.Rows)
{
using (var document = new Doc.Document())
{
document.LoadFromFile(template);
document.MailMerge.ClearFields = true;
var resultFile = Path.GetTempFileName() + ".docx";
document.MailMerge.Execute(dr);
document.IsUpdateFields = true;
document.ViewSetup.DocumentViewType = DocumentViewType.PrintLayout;
document.SaveToFile(resultFile);
Process.Start(resultFile);
}
}
The 3 previous merge issues reported by our clients are:
https://www.e-iceblue.com/forum/date-format-is-ignored-after-merge-eu-regional-settings-t11359.html
https://www.e-iceblue.com/forum/missing-thousand-separators-after-merge-t11360.html
https://www.e-iceblue.com/forum/wrong-merge-result-t12604.html
You can find attached the template and a merged document before the issue (version 8.7.0)