Export to Excel but keeping styles

hello,
is it possible to export grid data to excel with the specified styles (cell colors)?

https://stackblitz.com/edit/angular-ninkrn-utohw7?file=default.component.ts

thanks
regards
viktor


3 Replies

VA Venkatesh Ayothi Raman Syncfusion Team September 12, 2018 05:17 AM UTC

Hi Viktor, 

Thanks for using Syncfusion products. 

Query: is it possible to export grid data to excel with the specified styles (cell colors)? 

yes, it is possible to export grid data to excel with specified styles. To achieve your requirement, we have used excelQueryCellInfo event of the grid. In the function, we have passed the font color and background color of the cells to excel cells using style property. Please refer to the below sample and documentation for your reference. 

Code Example: 

[.ts] 
... 
excelQueryCellInfo(args: any){ 
       
      if (args.column.field === 'LastName') { 
        args.style={fontColor: "#fff", backColor: "#03a9f4"} 
        } 
    } 
... 



Please get back to us for further assistance. 

Regards,  
Venkatesh Ayothiraman. 



VI Viktor September 12, 2018 05:52 AM UTC

perfect!!
thanks!
regards
viktor


VA Venkatesh Ayothi Raman Syncfusion Team September 12, 2018 06:36 AM UTC

Hi Viktor, 
 
Thanks for the feedback. 
 
We are very happy to hear that your requirement is achieved. 
 
Regards,
Venkatesh Ayothiraman. 


Loader.
Up arrow icon