Change thousands and decimal separator - Angular spread sheet

Posted by: iteam on 8 July 2019, 7:43 pm EST

    • Post Options:
    • Link

    Posted 8 July 2019, 7:43 pm EST - Updated 3 October 2022, 1:48 am EST

    Hi everyone.

    I’m trying to figure it out how to change cell formatting in angular wrapper of spread sheet.

    I’ve seen that changing globalization doesn’t suit my needs.

    If the standard numeric format is "4,294,967,295.00 ",

    I’m searching a way to make it like this “4.294.967.295,000”.

    I’m not very practice with spread sheet and Angular wrapper doesn’t publish all the options described on sheets documentation.

    Since I haven’t reached the goal to set globalization, I’ve tried to use gc-column formatting:

    
    <gc-column [headerText]="'Gennaio'"
                        [width]="75"
                        [formatter]="'#,##0'"
                        [dataField]="'Gennaio'">
    </gc-column>
    
    

    The result has “,” has thousands separator and “.” as decimal separator.

    Can you suggest me a way to invert separators? Or maybe give me an help how to use a custom formatter with Angular wrapper?

    Thanks in advance.

  • Posted 9 July 2019, 5:36 pm EST

    Hi,

    To change the decimal and number separators, you need to add a custom culture with the specified settings:

    Please refer to the following code snippet and the attached sample demonstrating the same:

    let myCulture = new GC.Spread.Common.CultureInfo();
        myCulture.NumberFormat.numberDecimalSeparator = ",";
        myCulture.NumberFormat.numberGroupSeparator = "."; 
        myCulture.NumberFormat.listSeparator = ";";
        myCulture.NumberFormat.arrayListSeparator = ",";
    
        //add one culture
        GC.Spread.Common.CultureManager.addCultureInfo("myCulture", myCulture);
        //switch to "myCulture" culture
        GC.Spread.Common.CultureManager.culture("myCulture");
    

    Please refer to the following document for more info regarding creating a custom culture: http://help.grapecity.com/spread/SpreadSheets12/webframe.html#culturecustom.html

    Regards

    angular-culture-update.zip

  • Posted 9 July 2019, 6:25 pm EST

    Works perfectly.

    For Angular developers like me, that have started programming with typescript instead of javascript, docs based on javascript ar not very clear.

    Solutions like yours should be putted in spreadJs angular docs in my opinion!

    Thanks a lot four you help!

    ps: I’m not saying that is your fault. A typescript developer should know javascript as well, but is not mandatory for using Angular!

  • Posted 10 July 2019, 3:05 pm EST

    Thank you for your valuable feedback. We have forwarded your request for updating docs to the concerned team.

Need extra support?

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

Learn More

Forum Channels