Hello Adrian,
Thanks for sharing more information!
After further investigate, I found that even mail merge your file with MS Word, the "BARCODE" field cannot in the "Free 3 of 9 Extended" font. Kindly note that our Spire.Doc is following the MS Word standard, if the MS Word does not apply the font, our product cannot too.
You can consider setting the font of the "BARCODE" field before mail merge by referring to the following code. After setting font, the result is in "Free 3 of 9 Extended" font.
- Code: Select all
Document document = new Document();
document.LoadFromFile(@"E:\testdoc\barcodefile\barcode_input_file.docx");
foreach(Field field in document.Fields)
{
if(field.Type == FieldType.FieldMergeField)
{
MergeField mergeField = field as MergeField;
if (mergeField.FieldName == "BARCODE")
{
mergeField.CharacterFormat.FontName = "Free 3 of 9 Extended";
}
}
}
DataTable dataTable = new DataTable();
dataTable.Columns.Add(new DataColumn("BARCODE"));
dataTable.Rows.Add(new string[] { "1234567" });
dataTable.Rows.Add(new string[] { "2345789" });
dataTable.Rows.Add(new string[] { "8245920" });
dataTable.Rows.Add(new string[] { "5047891" });
dataTable.Rows.Add(new string[] { "4517152" });
document.MailMerge.Execute(dataTable);
document.SaveToFile("res.docx");
Sincerely,
Marcia
E-iceblue support team