[format]="'c2'" is not working while export the excel sheet

Posted by: rajalakshmi.sm on 17 June 2018, 6:16 pm EST

    • Post Options:
    • Link

    Posted 17 June 2018, 6:16 pm EST

    Hi

    [format]=“‘c2’” is not working while export the excel sheet. But [format]=“‘c3’” (c4 also ) provide the expected (currency symbol with) result.

    For example :

    Consider, I have a currency column formatted with c2 in my excel sheet export report. Its working properly in US region( $ symbol showed in currency column) . In India region, the currency symbol is ₹ showed in excel sheet report. We need to display $ symbol only in currency column with 2 decimal points.

    Regards,

    Raje

  • Posted 17 June 2018, 6:29 pm EST

    Hi

    Environment details is listed below for the issue of [format]=“‘c2’” is not working while export the excel sheet.

    OS:- Windows 10 64-bit

    Wijmo:- 5.20162.231 (Licensed Version)

    Angular:- Angular 2.x

    Regards,

    Raje

  • Posted 19 June 2018, 1:06 am EST

    Hi,

    The observed behavior is because the C2 format is recognized as excel currency format so trying to localize the data by showing local currency symbol.

    To avoid this, add following lines of code in your export method:-

    
    exportToExcel(flexSheet){
    	var colWithFormatC2=4;
    	var wb=flexsheet.save();
    	wb.sheets[0].columns[colWithFormatC2].style.format="_("+wb.sheets[0].columns[colWithFor		matC2].style.format;
    	wb.sheets[0].rows.forEach((row,index)=>{
    		if(index!=0){
    			row.cells[colWithFormatC2].style.format="_("+row.cells[colWithFormatC2].style.format;
    		}
    	});
    	wb.saveAsync("samplecur.xlsx"); 
    }
    

    Please refer to the following demo sample:

    https://stackblitz.com/edit/angular-rfw3vg?file=app%2Fapp.component.ts

    Hope it helps!

    ~Manish

  • Posted 21 June 2018, 7:54 pm EST

    Hi Manish,

    Thank you, Its working as expected.

    Regards,

    Raje

Need extra support?

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

Learn More

Forum Channels