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

Export grid to excel cells with hyperlink

10 Answers 1586 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hajrija
Top achievements
Rank 1
Hajrija asked on 05 Feb 2015, 09:49 AM
Hi, 

is there any way to export excel grid and to define for each cell hyperlink? 
Currently cell values are web addresses but not hyperlink.

Thanks

10 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 09 Feb 2015, 08:43 AM
Hello Hajrija,

Excel export functionality of the Grid exports only the data values (directly from the data source). If you would like to modify the output values and format them, then you can use the excelExport event and modify the result set before it is passed to the OOXML parser. Please refer to this "How-to" demo that demonstrates the aforementioned cell modification.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Aaron
Top achievements
Rank 1
answered on 05 Mar 2015, 07:30 PM
I am also interested in this functionality.   When I use the method referred to in the "How to" above, the resulting Excel cells contain the full text of the Excel HYPERLINK function, but it isn't a real hyperlink.   Is there something I am missing?

Thanks
Aaron
0
Atanas Korchev
Telerik team
answered on 09 Mar 2015, 08:41 AM
Hi,

Excel doesn't support rendering of HTML cell values. This is why the Kendo UI grid doesn't use the column template during Excel export.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Aaron
Top achievements
Rank 1
answered on 16 Mar 2015, 02:05 PM
Thank you for your reply Atanas.    I'm not actually trying to get the HTML to render within the cell, I just need a clickable link using the Excel hyperlink function (please see the attached file).  

Here is the code that I am using.   When I open the resulting file, the cell contains the literal text of the hyperlink function.   Am I trying to do something that isn't currently possible?


        excelExport: function(e) {
          var sheet = e.workbook.sheets[0];
         
          for (var i = 1; i < sheet.rows.length; i++) {
            var row = sheet.rows[i];
            row.cells[0].value = '=HYPERLINK("http:www.google.com","Click for Google")';
          }
        }

0
Atanas Korchev
Telerik team
answered on 18 Mar 2015, 06:41 AM
Hello Aaron,

You are right. The Kendo UI Grid Excel export doesn't currently support hyperlinks. It can export JavaScript primitive values - String, Number, Date, Boolean. You can also set the background, foreground, font, font size, bold, italic, underline and alignment. The full list of supported cell options is available here.

Feel free to open a new feature request in our feedback portal.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
DVS InteleStream
Top achievements
Rank 1
answered on 27 May 2016, 08:09 PM

I agree this would be very useful.

Here is the feature request link for this: http://kendoui-feedback.telerik.com/forums/127393-kendo-ui-feedback/suggestions/8507851-hyperlink-support-when-exporting-kendo-grid-to-exc

0
Teguh
Top achievements
Rank 1
answered on 26 Jul 2016, 09:16 AM

Hi Both,

I have similar query here. Is the new kendo ui export to excel already has this functionality? (hyperlink to excel)

If not yet, is there any workaround? Thanks :)

 

Warm regards, 

TS

0
Georgi Krustev
Telerik team
answered on 28 Jul 2016, 07:39 AM
Hello TS,

I am afraid that the desired functionality is still not supported. I would not be able to provide a feasible workaround for the time being.

I would suggest you cast your vote for the feature request, as this would help to increase the interest to it.

Regards,
Georgi Krustev
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
1
Brian
Top achievements
Rank 1
answered on 09 May 2017, 03:17 PM

This is what worked for me:

 row.cells[0].formula = '=HYPERLINK("http:www.google.com","Click for Google")';

However, I will say Excel's 2016's security around hyperlinks is hideous and they don't even display until you get the document out of "Protected View".  And then when the user clicks on the link they get a warning that there may be a virus....but this works...

 

Steve
Top achievements
Rank 1
commented on 01 Aug 2022, 10:22 AM

Brian, 

This was many years ago when you posted this, but helped me out greatly. Thanks!

1
Alain
Top achievements
Rank 1
answered on 11 May 2017, 11:47 AM

Hello,

I was working on the same functionnality today and based on your sample and ideas, I've made a generic Excel export handler which will convert all column with a template hyperlink to an Excel hyperlink formula. If you have any interest you can find my implementation here : http://dojo.telerik.com/@Alain/ACUVa/2

Best regards,

Alain

 

Abraham
Top achievements
Rank 1
Iron
commented on 03 Feb 2024, 07:02 PM

@Alain - Something you did nearly 7 years ago still proves useful, your example was excellent. Glad I found this post.
Tags
Grid
Asked by
Hajrija
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Aaron
Top achievements
Rank 1
Atanas Korchev
Telerik team
DVS InteleStream
Top achievements
Rank 1
Teguh
Top achievements
Rank 1
Brian
Top achievements
Rank 1
Alain
Top achievements
Rank 1
Share this question
or