Excel Export

Hi, 

In the feature of exporting to excel, is it possible to create the excel using the "field" the instead the "header text"  as column name?

Thanks!!

3 Replies 1 reply marked as answer

MS Manivel Sellamuthu Syncfusion Team August 7, 2020 12:18 PM UTC

Hi Carlos, 

Greetings from Syncfusion support. 

Yes. You can achieve your requirement by using excelHeaderQueryCellInfo event of the Grid. Please refer the below code example and sample for more information. 

<template> 
  <div id="app"> 
    <ejs-grid 
. . . 
      :excelHeaderQueryCellInfo="excelHeaderQueryCellInfo" 
    > 
       . . . 
           </ejs-grid> 
  </div> 
</template> 
<script> 
 
Vue.use(GridPlugin); 
 
export default { 
 . . . 
  methods: { 
    toolbarClick: function(args) { 
      if (args.item.text === "Excel Export") { 
        this.$refs.grid.ej2Instances.excelExport(); 
      } 
    }, 
    excelHeaderQueryCellInfo: function(args) { 
      args.cell.value = args.gridCell.column.field; 
    } 
  }, 
 . . . 



Please let us know, if you need further assistance. 

Regards, 
Manivel 


Marked as answer

CA Carlos Alarcon August 7, 2020 03:47 PM UTC

Many thanks Manivel ! :) 


MS Manivel Sellamuthu Syncfusion Team August 10, 2020 04:58 AM UTC

Hi Carlos, 

Thanks for your update. 

Please let us know, if you need further assistance. 

Regards, 
Manivel 


Loader.
Up arrow icon