We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Handling MergeFormat errors

I had an issue during Mail Merge where the datasource had a value of 1000 which then needed to be mailmerged and formatted into currency. The expected output was $1,000.00

Word would produce a value of 1000 but Aspose (saving as PDF) would produce a value of 1.

It turns out that it was due to the user entering in a bad MergeFormat string. My concern is that Word handled this error by just displaying the raw datasource value, whereas Aspose seemed to just convert to "1".

In the event that a user enteres in a bad mergeformat string in the future, I would like to be able to handle this error.

Do you have any suggestions?

Hi,

Thanks for your inquiry. I have tested the scenario and have not found any issue with currency formatting while using latest version of Aspose.Words for .NET. Please use the latest version of Aspose.Words for .NET. If you still face problem, please share your document for investigationpurposes.

Document doc = new Document(MyDir + "in.docx");

doc.MailMerge.Execute(new string[] { "num" }, new object[] { 1000 });


doc.Save(MyDir +
"AsposeOut.docx");


Moreover, You may use FieldOptions.FieldUpdateCultureSource property to specify what culture to use during field update. By default, the culture of the current thread is used. I would suggest you please read the following links for your kind reference.
http://office.microsoft.com/en-us/word-help/insert-and-format-field-codes-in-word-2007-HA010338798.aspx#BM8
http://office.microsoft.com/en-us/word-help/field-codes-mergefield-field-HP005186172.aspx

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.