Click here to Skip to main content
15,851,701 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am able to bind urls from datatable to Excel. But they are showing as text urls and need to double click in cell to activate them. I wanted to bind as urls and allow user to click on them to open webpage. Don't want user to double clik on cell to activate url.

What I have tried:

I am not getting any ideas on how to implement this feature. Thank you
Updated 14-Jun-19 8:09am
Gerry Schmitz 13-Jun-19 21:56pm    
What's this got to do with c#? You don't show any code. It's "your idea".

1 solution

Seems you're exporting data as a text from a datatable to an Excel sheet...

All you need to do is to add hyperlinks to cell, see: Hyperlinks.Add(Object, String, Object, Object, Object) Method (Microsoft.Office.Interop.Excel) | Microsoft Docs[^]

//Define a range object(A1).
Excel.Range _range;
_range = objSheet.get_Range("A1", "A1");
//Add a hyperlink to it.
objSheet.Hyperlinks.Add(_range, "", Type.Missing, "Click to visit '' site", "Exaample site!");
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900