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

exporting hyperlink to excel

1 Answer 379 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Iron
Dan asked on 18 May 2020, 04:39 PM

Hello,

I have read the other threads, and I am not having much success. I can export a URL as text, but I haven't been able to get it to show up as a clickable link in an xlsx file. Can someone please help me? Below are the examples preceded by a note about its behavior:

 

[ This one doesn't show anything in the text cell. I read on an old post that this is to be expected. ]
<telerik:GridHyperLinkColumn AllowFiltering="False" AllowSorting="False" Visible="true"
 HeaderText="View0.0"
 Text="View Page"
 Target="_blank"
 DataNavigateUrlFormatString="page.aspx?autoid={0}"
 DataNavigateUrlFields="SpecimenAutoID">
    <HeaderStyle Width="50px" HorizontalAlign="Center"></HeaderStyle>
</telerik:GridHyperLinkColumn>

[This displays the cell as source html.]
<telerik:GridTemplateColumn HeaderText="View1.0" >
    <ItemTemplate>
        <a href="https://www.google.com">Click here to open the folder</a>
    </ItemTemplate>
    <HeaderStyle Width="200px" HorizontalAlign="Center"></HeaderStyle>
</telerik:GridTemplateColumn>

[This displays the cell as source html.]
<telerik:GridTemplateColumn HeaderText="View1.1" >
    <ItemTemplate>
        <a href="https://www.google.com">https://www.google.com</a>
    </ItemTemplate>
    <HeaderStyle Width="200px" HorizontalAlign="Center"></HeaderStyle>
</telerik:GridTemplateColumn>

 

[This displays the link as a text string.]
<telerik:GridTemplateColumn HeaderText="View1.2" >
    <ItemTemplate>
        https://www.google.com
    </ItemTemplate>
    <HeaderStyle Width="200px" HorizontalAlign="Center"></HeaderStyle>
</telerik:GridTemplateColumn>

[This displays the data field as text string]
<telerik:GridBoundColumn Visible="false" SortExpression="directURL" HeaderText="View Specimen" HeaderButtonType="TextButton"
                         DataField="directURL" Exportable="True" UniqueName="hiddenDirectURL" >
    <HeaderStyle Width="200px" HorizontalAlign="Center"></HeaderStyle>
</telerik:GridBoundColumn>

Any suggestions would be appreciated. Thanks.

Dan

 

1 Answer, 1 is accepted

Sort by
0
Doncho
Telerik team
answered on 21 May 2020, 10:07 AM

Hi Dan,

Thank you for the samples provided!

When the required export format is XLSX, some additional customization of the export is needed.

Exporting to XLSX format is based on the TelerikProcessing Libraries. Therefore, the RadSpreadProcessing library could be the best place to look for an answer. Here are some articles that may help in solving the case:

On the other hand, when exporting to Excel HTML format exporting links is done automatically. You can try the sample project provided in this forum thread - Editting GridHyperLinkColumn NavigateUrl in codebehind

Please go through the suggested articles and let me know if they help.

Kind regards,
Doncho
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Grid
Asked by
Dan
Top achievements
Rank 1
Iron
Answers by
Doncho
Telerik team
Share this question
or