Click here to Skip to main content
14,331,194 members
Rate this:
Please Sign up or sign in to vote.
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 7: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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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!");

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100