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

Free Support Forum - aspose.com

Mail Merge - Trimming values in formatted numeric merge fields

Hello,

I noticed that handling of formatted numeric values in mail merge have changed from Version 11.x to Version 14.x of Aspose.Words.

I have a template with the format
# “### ### ##0,00”
in a merge Field. In older Versions (v11.x) leading and trailing whitespace were trimmed during the merge but this has changed in the current Version (v14.x)

An example is the number 1234.56. In the older Versions this would end up as “1 234,56”, while the current Version of Aspose.Words outputs " 1 234,56".

I have found another other post discussing this issue (Number formatting changes with v14.x - extra space in formatted mergefield) but since the API seems to have changed since this post I cannot find a way to do this.

Does there exist a way to trim off whitespace during/after merge that would make it possible for me to format a numeric value with thousand separators and decimals?

thanks,

Henrik

Hi Johnny,

Thanks for your inquiry. Please note that the latest version of Aspose.Words mimics the same behavior as MS Word does. If you perform the same mail merge operation using MS Word, you will get the same output.

Please use the latest version of Aspose.Words for .NET 14.10.0. If you still face problem, please share following detail for investigation purposes. We will then provide you more information on this along with code.

  • Please attach your input Word document.
  • Provide information about your specific culture, such as the name of the culture, language and country/region.


Hello,



I am aware that the functionality is now just as it would be in Word, so this is an inquiry to ask whether you have a suggestion to how I could fix this issue either by changing the format string in my template or by modifying the merged value to get the desired result in a callback (as in the Attached link in the first post)



The changed functionality in a past release hits our customers; they are getting frustrated since their previously working templates now have been “destroyed” by us due to the modified handling in Aspose.Words.



thanks, Henrik

Hi Johnny,

Thanks for your inquiry.


Please accept my apologies for your inconvenience. The Aspose.Words behaviour in older version was not correct and fixed in latest versions.

In your case, I suggest you please implement IFieldMergingCallback interface if you want to control how data is inserted into merge fields during a mail merge operation. Hope this helps you.