I have decimal token with decimal separator as ‘.’ , I need to display the value with decimal separator as comma. I have tried handling in template using C Sharp string functions. But
<<[amount.ToString(“N2”, System.Globalization.CultureInfo.GetCultureInfo(“fr-FR”))]>> → doesn’t seem to be working.
<<[amount.ToString(“N2”, new System.Globalization.CultureInfo(“fr-FR”))]>> → this throws an exception, as Aspose doesn’t support new to instantiate objects.
What other options do I have? I cannot afford to make any code changes, as it’s a one-off case, so, I don’t want to Change the culture of the Engine before building it
To format a decimal value with a comma as the decimal separator in Aspose.Words without changing the culture of the engine or making code changes, you can use a specific number format string.
In your case, instead of using amount.ToString("N2", System.Globalization.CultureInfo.GetCultureInfo("fr-FR")), you can try using a format string that explicitly defines the desired output. For example, you can use the following format:
This format string will ensure that the number is formatted with a comma as the decimal separator. However, since you mentioned that you cannot instantiate new objects, you should ensure that the culture is set correctly in your template or document settings.
If you are still facing issues, it might be helpful to check the output in MS Word to see how it formats similar numbers. You can do this by creating a mail merge field in Word and previewing the results, which can provide insight into how the formatting is applied.
For further assistance, you may want to refer to discussions on number formatting in Aspose.Words, as they provide insights into handling locale-specific formatting issues effectively.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.