Excel export set pattern style

1 Answer 16 Views
Grid
A
Top achievements
Rank 1
A asked on 13 May 2024, 12:27 PM

Hi Team,

Is there any way to set the pattern color and pattern style of a cell before exporting to excel using jQuery?

Thanks,

Julian A

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 16 May 2024, 10:31 AM

Hi,

To apply background color to he exported Excel file you need to handle the excelExport event and modify the e.workbook object. 

sheets.rows.cells.background

For example:

      excelExport: function(e) {
            e.workbook.sheets[0].rows.forEach(row=>{
              row.cells.forEach(cell=>{
                // apply background color to 'Alice Mutton'
                if(cell.value && typeof cell.value=="string" && cell.value === "Alice Mutton"){
                  cell.background = "#FF0000";
                }
              })
            })
          }

Dojo demo: https://dojo.telerik.com/IxAraqaz

Regards,
Nikolay
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Tags
Grid
Asked by
A
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or