Adjust cell format for current region

Posted by: peter.bozek on 25 October 2021, 12:31 pm EST

  • Posted 25 October 2021, 12:31 pm EST

    I would like to prepare SpreadJS sheets that could be distributed to several countries and would display, in each country, numbers in correct format according to user’s region. It means, it will use display

    123 456,78 € in Germany,

    123’456.78 CHF in Switzerland and, say

    123,456.75 £ in GB.

    The formats are defined by system and can be read from it. I would like to avoid necessity to define specific report for each country. I checked it and, when I define format “###'##0.00” it will display correct format in Switzerland, but this in my case would not work.

    I can run a script before displaying report, so I could run script that would loop through all cells, read in format and map it to proper region’s format, but it seems to me that there should (and probably is) a way how to tell SpreadJS to use current region’s formatting.

  • Posted 26 October 2021, 7:28 am EST

    Hi,

    For this, you need to set the culture according to the region. Please refer to the following Demo that demonstrates the same and let me know if you face any issues.

    Demo: https://www.grapecity.com/spreadjs/demos/features/culture/globalization/purejs

    You may also create a custom culture as explained in the following docs.

    custom culture: https://www.grapecity.com/spreadjs/docs/v14/online/culturecustom.html

    Regards

    Avinash

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels