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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfDataGrid Image Column Export

Thread ID:

Created:

Updated:

Platform:

Replies:

124770 Jun 29,2016 05:31 AM UTC Jul 8,2016 04:14 AM UTC WPF 5
loading
Tags: SfDataGrid
yapwen
Asked On June 29, 2016 05:31 AM UTC

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

Elavarasan M [Syncfusion]
Replied On 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

yapwen
Replied On 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

Elavarasan M [Syncfusion]
Replied On 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

yapwen
Replied On July 7, 2016 02:08 PM UTC

Dear Elavarasan,

Thanks for reply.

Thank you.

Regards,
Yap

Elavarasan M [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;