We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Mail Merge and Numberformatting

Hi there.

I have trouble getting the mail merge feature to format my numbers correctly.

If I add a Mail Merge field like listed below , it ignores my format. Or actually, it trims away my decimalseparator, doesn't add thousand seperators and then and appends 0,00.

{ MERGEFIELD FieldName  \# "#.00" } 
{ MERGEFIELD FieldName  \# "#,00" }
{ MERGEFIELD FieldName \# "#,###.00%" }
{ MERGEFIELD FieldName \# "#.###,00%" }

My datasource is a Decimal.

I cannot find any documentation on this topic, which makes me wonder, if the feature even is supported?

I have created the template with DocIO, modified the fieldcode (ALT+F9) adding numberformat in Word 2013. Generated document based on the template with DocIO and views the document in Word 2013.

I have found out, that if I make a formula, as {=({ MERGEFIELD FieldName} + 0) \# "0,000.00" } then I can get it formatted - in English format only. Everything is set to Danish, environment, global culture etc.

I appreciate any feedback.

//Nicky


3 Replies

SK Sathish K Syncfusion Team February 18, 2015 12:26 PM UTC

Hi Nicky,

Thank you for your interest in Syncfusion products.

Kindly specify the number format in merge field and the input string in English culture format and then change the System’s culture to the desired one (Danish) in sample level then perform the mail merge to retain the desired number format. We have prepared a sample to illustrate the same. Please find the sample from below link:

Sample link:
http://www.syncfusion.com/downloads/support/directtrac/118247/Sample724512912.zip

If this doesn’t resolve your issue, then kindly update us your input template document, code snippet or sample used in your side along with the expected output number format. Thereby we will analyse further on the mentioned issue and provide you appropriate solution.

Regarding issue with Formula field:
Kindly update us your test case document along with the code snippet or sample to reproduce the issue. It will help us to analyse further on the mentioned issue.

Please let us know if you have any other questions.

Regards,
Sathish




NM Nicky Mogensen February 18, 2015 01:05 PM UTC

Thanks for your answer, but the sample provided has the same problem.

- Changing values on line 55 to: string[] values = { "1000.346", "1000.4635"};
- Change to US culture on line 58: System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
- Run the sample

The output is then:

1000.35

1,000.46%

Which is correct. Both lines has two decimals, and the bottom line has a thousandseparator. 

Now  do:

- Change back to Danish culture on line 58: System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("da-DK")
- Run the sample

The output is now:

1000,35

1000,46350%

First line is fine, but the second line is missing a thousandseparator ( . ) and has too many decimals.


//Nicky




SK Sathish K Syncfusion Team February 19, 2015 12:24 PM UTC

Hi Nicky,

We were able to reproduce the reported issue with number formatting and we have logged defect report regarding this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents  

Please let me know if you have any questions.

Best,
Sathish



Loader.
Live Chat Icon For mobile
Up arrow icon