This is a migrated thread and some comments may be shown as answers.

Export RadGridView to Excel.

1 Answer 132 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Vimal
Top achievements
Rank 1
Vimal asked on 13 Dec 2013, 01:34 PM
Hi,
I have a
RadGridView in which there are 3 image columns. While exporting RadGridView to excel using ExportToExcelML class, all image columns are exported empty. Requirement is to display text instead of images. Is there a way to convert Image columns to text column or any other possible ways to achieve?

 

Also, I should export only visible columns in RadGridView and the text columns should be present only in the exported excel file and not to be displayed in RadGridView.

We are using Telerik Control version : 2013.3.1127.40

Regards,
Vimal

 

 

 

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 18 Dec 2013, 09:11 AM
Hello Vimal,

Thank you for contacting Telerik support.

For the first case you can use the ExcelCellFormatting event to export text for the image column:
void exporter_ExcelCellFormatting(object sender, Telerik.WinControls.UI.Export.ExcelML.ExcelCellFormattingEventArgs e)
{
    if (e.GridColumnIndex == 4 && e.GridRowIndex != -1)//4 is the index of the image column and -1 is the index of the header row
    {               
        e.ExcelCellElement.Data.DataItem = "Test";
    }
}

For the second case you can use the HiddenColumnOption property to export only visible columns:
exporter.HiddenColumnOption = HiddenOption.DoNotExport;

Let me know if you have additional questions.

Regards,
Dimitar
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Vimal
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or