Change image to text on export

1 Answer 38 Views
Grid
Fabio
Top achievements
Rank 1
Iron
Fabio asked on 10 Oct 2022, 08:25 PM
Hello,

I would like to know the smallest way to change an image to text when exporting to excel.

My column is of type GridTemplateColumn with a literal object carrying the image, as in the example below, inside an ItemDataBound.

  If CBool(e.Item.DataItem("Read")) = True Then
                 litStatus.Text = "<i Class=""fa fa-envelope-open-o fa-2x"" title=""Read""></i>"
             Else
                 litStatus.Text = "<i Class=""fa fa-envelope-o fa-2x"" title=""Unread""></i>"
             End If

Thank you very much in advance
Fabio
Top achievements
Rank 1
Iron
commented on 11 Oct 2022, 07:56 PM

Another possibility would be to have two literal objects, one with the image path and the other with the text, if it were in the Grid presentation it would present the image literal and if it were to export to excel it would present the literal text, using the visible status, But I couldn't do that either.

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 13 Oct 2022, 09:47 AM

Hi Fabio,

The Export Template Columns article shows how to replace the cell content with Text. 

In case you need to reference the Controls in the cells so that you can access the Control properties, the Accessing Controls in RadGrid article provides details along with various examples that you can try.

I can give you a more specific example, but for that, I need to see the entire implementation of the Grid.

Regards,
Attila Antal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Fabio
Top achievements
Rank 1
Iron
Answers by
Attila Antal
Telerik team
Share this question
or