We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SfDataGrid Image Column Export

Hi,

How to Export the image data in the image column in SfDataGrid .

Attached is the sample shown SfDataGrid export to excel with data except image data.

Thanks.

Regards,
Yap

Attachment: SfDataGridExport_155d0c52.zip

5 Replies

EM Elavarasan M Syncfusion Team June 30, 2016 01:45 PM UTC

Hi Yap, 

Thank you for contacting Syncfusion support. 

We have analyzed your query and prepared the sample to export GridImageColumn into Excel as well as PDF.  
 
Please find the sample from below, 

 

Note: You have to set the UseBindingValue to the column as true when loading Image through converter and the underlying property of GridImageColumn is string. Otherwise you have to set the GridImageColumn underlying property as  BitMapImage instead of string.  

You can refer the below UG documentation to know more about the excel exporting, 


Also refer the below UG documentation to know more about the PDF exporting, 


You can also refer the below KB to know about the GridTemplateColumn PDF exporting, 


Regards, 
Elavarasan M


YA yapwen June 30, 2016 02:06 PM UTC

Hi Elavarasan,

Thanks for reply.

Attached is the excel file from exported. Its look a bit messy.

How to make the row height as shown in SfDataGrid for exported excel file.

Thanks Elavarasan.

Regards,
Yap

Attachment: Excel_Row_Height_3351a832.zip


EM Elavarasan M Syncfusion Team July 1, 2016 11:33 AM UTC

Hi Yap, 
 
Thanks for your reply. 
 
You can change the entire row height and the column width while exporting the SfDataGrid to excel like the below code example, 
 
var options = new ExcelExportingOptions(); 
ExcelEngine excelEngine = new ExcelEngine(); 
IWorkbook workBook = excelEngine.Excel.Workbooks.Create(); 
workBook.Worksheets.Create(); 
options.ExportMode = ExportMode.Text; 
this.dataGrid.ExportToExcel(dataGrid.View, options, workBook.Worksheets[0]);             
workBook.Worksheets[0].Range.RowHeight = 70; 
 
workBook.Worksheets[0].Range.ColumnWidth = 100; 
 
You can also set the particular row height and particular column width like the below code example, 
 
workBook.Worksheets[0].SetColumnWidth(1, 30); 
 
workBook.Worksheets[0].SetRowHeight(1, 30); 
 
We have modified the sample based on this and please find the sample from below, 
 
 
 
You can refer the below UG documentation to know about the row height and column width customization while exporting the SfDataGrid, 
 
 
Regards, 
Elavarasan M


YA yapwen July 7, 2016 02:08 PM UTC

Dear Elavarasan,

Thanks for reply.

Thank you.

Regards,
Yap


EM Elavarasan M Syncfusion Team July 8, 2016 04:14 AM UTC

Hi Yap,

Thank you for your update.


Please let us know if you require any other assistance.

Regards, 
Elavarasan M

Loader.
Up arrow icon