Thanks for your inquiry.
Can you please explain why these formats were allowed and merging was working in Aspose version 9.8? Can you confirm if it was a bug in that version?*
The behavior of older version of Aspose.Word is incorrect. This was a bug in older version and fixed in latest versions of Aspose.Wods.
Please note that Aspose.Words mimics the same behavior as MS Word does.
If you perform the same mail merge operation with same values using MS
Word, you will get the same output.
what would be your suggestion, how do we go about fixing them? Is it possible for you to provide an automated example of modifying the format in merge field using Aspose dll.*
In this case, you need to remove the mail merge fields which contain number formatting and insert it again at same position with mail merge field name and number formatting. Please check following code example for your kind reference. Hope this helps you. I have attached the output document with this post for your kind reference.
DataTable table = new DataTable();
table.Rows.Add("1234567890", "Aspose", DateTime.Now, 500.07, 600.80, 700.36);
Document doc = new Document(MyDir + @"$ Scenario Replication.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
foreach (Field field in doc.Range.Fields)
if (field.Type == FieldType.FieldMergeField && field.GetFieldCode().Contains(@"\#"))
String numberformat = field.GetFieldCode().Replace(@"\*", "").Replace("MERGEFORMAT", "").Replace("MERGEFIELD", "").
Replace("Upper", "").Replace("Lower", "").Trim().Split(' ');
numberformat = numberformat.Where(val => val != "").ToArray();
if (numberformat.Length > 1)
String mailmerge = "MERGEFIELD ";
foreach (String item in new ArrayList(numberformat))
mailmerge += " " + item;
doc.Save(MyDir + "Out.doc");