Export RadGridView to Excel.

2 posts, 0 answers
  1. Vimal
    Vimal avatar
    5 posts
    Member since:
    Apr 2012

    Posted 13 Dec 2013 Link to this post

    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

     

     

     

  2. Dimitar
    Admin
    Dimitar avatar
    2913 posts

    Posted 18 Dec 2013 Link to this post

    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 >>
Back to Top