How do you include an image in the header of an Excel grid export using ExcelExportProperties

Hello, I have a datagrid in an asp.net core web page that I'm exporting to Excel using the grid object excelExport javascript method. With this export, I'm using the excel export properties to include a bit of text above the grid within the excel document. I'd like to know how to write an image to the space above the grid. I have the image info stored in a base64 string within my view model. I've tried a few variations within the header object of the excel properties, but with no luck to this point. Below are my javascript calls to do the export, as you can see I've commented out a couple of earlier tries to get the image to export.

Any help would be appreciated.

Thanks,

Paul

function toolbarClick(args) {

var gridObj = document.getElementById("Grid").ej2_instances[0];

if (args.item.id === 'Grid_excelexport') {

gridObj.excelExport(getExcelExportProperties());

}

}

function getExcelExportProperties() {

return {

header: {

headerRows: 7,

rows: [

{

index: 2,

cells: [

//{ index: 2, rowSpan: 6, value: "image goes here" },

//{ index: 2, rowSpan: 6, value: '@Model.LogoImageBase64String' },

{ index: 2, rowSpan: 6, image: { base64: '@Model.LogoImageBase64String'} },

{ index: 2, rowSpan: 6, value: {image: { base64: '@Model.LogoImageBase64String'} }},

{ index: 8, value: '', style: { backColor: '#C6E0B4' } },

{ index: 9, value: 'Personnel' }]

},

{

index: 3,

cells: [

{ index: 8, value: '', style: { backColor: '#C58BD5' } },

{ index: 9, value: 'Classifications' }]

}

]

}

};

}


1 Reply

RR Rajapandi Ravi Syncfusion Team July 31, 2023 10:48 AM UTC

Hi Paul,


Greetings from Syncfusion support


Currently, the EJ2 Grid doesn’t have the support to export the images at the header and footer of the excel file. We logged a feature task for your requirement as Provide support to export images at the header and footer of the excel file from Grid and added it to our feature request database. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technical feasibility, and customer interest. This feature will be included in any of our upcoming releases. 


Feedback Link: https://www.syncfusion.com/feedback/41900/provide-support-to-export-images-at-the-header-and-footer-of-the-excel-file-from


You can communicate with us regarding the open features any time using the above Feature Report page.  


Regards,

Rajapandi R


Loader.
Up arrow icon