Sfdatagrind export to excel with image

I add to grid GridImageColumn,  and replace data from model to image. This is ok, but when I have export grid to excel I have error  System.ArgumentNullException Buffer cannot be null. parameter name: buffer


 private void sfDataGrid_QueryImageCellStyle(object sender, QueryImageCellStyleEventArgs e)

 {

     if (e.Column.MappingName == "HasMR" || e.Column.MappingName == "HasRC")

     {

         if (e.DisplayText == "1")

         {

             e.Image = Properties.Resources.check_tmp;

             e.ImageLayout = ImageLayout.Zoom;

         }

         else

         {

             e.Image = null;

         }

         e.DisplayText = string.Empty;

     }

 }



public void ExportExcel()
  {    
      var options = new ExcelExportingOptions();
      options.AllowOutlining = true;
      options.ExcelVersion = ExcelVersion.Excel2016;
      var excelEngine = sfDataGrid.ExportToExcel(sfDataGrid.View, options); <-error
}


1 Reply

SG Santhosh Govindasamy Syncfusion Team October 21, 2024 10:14 AM UTC

Hi Krzysztof,

Thank you for reaching out.


Based on the information and code snippet you provided, we attempted to replicate the reported exception on our end by creating a simple sample. However, we were unable to reproduce the exception; everything worked as expected. For your reference, we have attached the sample for you to review.


To assist you further, could you please share details of any other customizations you have implemented in your sample? Additionally, kindly provide the product-related details, such as which product and framework version you are using. If possible, please try to replicate the issue using our provided sample.


This information will help us understand the problem better and provide an appropriate solution. Thank you for your cooperation, and we look forward to your response.

Regards,
Santhosh.G


Attachment: SfDatagrid_Demo_85068373.zip

Loader.
Up arrow icon