Remove Comma From Grid Excel Export

Dear Team

In grid  XYZ Column value is 77,95,87,687.89, but when we export grid into excel we want the cell value like this  779587687.89. This feature we want in grouping grid normal column, GroupFooterTemplate and GroupCaptionTemplate and without grouping grid also at the time of excel export.



3 Replies

RR Rajapandi Ravi Syncfusion Team August 31, 2022 08:05 AM UTC

Hi Nagendra,


Greetings from Syncfusion support


Based on your query we could see that you like to remove the commas from the string, based on your query we have prepared a sample and achieved your requirement by using regex function of the JavaScript. Please refer the below code example and sample for more information.


 

exportQueryCellInfo(args: ExcelQueryCellInfoEventArgs): void { //excelQueryCellInfo event of Grid

        if(args.column.field === 'FormatNuber') {

            args.value = (args.value as any).replace(/,/g, ''); //using regex

 

        }

    }

 


Sample: https://stackblitz.com/edit/angular-gz8mxm?file=app.component.ts,app.component.html,data.ts


You can use the custom helper function with the caption template and footer template and return the string using the same regex to remove the commas to achieve your requirement. Please refer the below KB for more information.


KB: https://www.syncfusion.com/kb/11253/how-to-apply-formatting-for-the-group-caption-template


Regards,

Rajapandi R



NG Nagendra Gupta September 2, 2022 07:45 AM UTC

Hi Rajapandi Ravi,


Thanks For your Reply.

Your example only work on without Grouping. We want this feature  in grouping grid column and also in  GroupFooterTemplate at the time of excel export.



RS Rajapandiyan Settu Syncfusion Team September 5, 2022 05:42 PM UTC

Hi Nagendra,


Thanks for your update.


Before proceeding with your query, kindly share the below details to provide a better solution.


  1. Share the complete Grid code files (app.component.html & app.component.ts) and package.json file.
  2. Share the data type of XYZ column. Did the XYZ field have the data in number format ([{ XYZ: 779587687.89 }]) or string format ([{ XYZ: 77,95,87,687.89 }])?
  3. Share the example dataSource (data structure) which will be very helpful for us.
  4. Share the video demo/ screenshot of your requirement.
  5. If possible, share a simple issue reproducible sample.


Regards,

Rajapandiyan S


Loader.
Up arrow icon