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' }]
}
]
}
};
}