We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

add hyperlinks to cell

Hi,

exporting a datatable to excel sheet using ImportDataTable function and one of the column is a link.

How can i add hyperlinks to the cells after importing the data to excel?

Regards,
Navin


3 Replies

NA Navin November 11, 2011 06:46 AM UTC

hi,

can please an answer for my question.

thanks
navin



AD Administrator Syncfusion Team November 14, 2011 01:40 AM UTC

Hi Navin,

Sorry for the delayed reply.

Thank you for using Syncfusion product.

XlsIO provides interactive features support to convert the cell text to a hyperlink. Please follow the below code snippet for your requirement.

//Creating Hyperlink for a Website
IHyperLink hyperlink = worksheet.HyperLinks.Add(worksheet.Range["C5"]);
hyperlink.Type = ExcelHyperLinkType.Url;
hyperlink.Address = "http://www.syncfusion.com/products/xlsio/windows/default.aspx";
hyperlink.ScreenTip = "To know more About XlsIO go through this link";

//Creating Hyperlink for e-mail
IHyperLink hyperlink1 = worksheet.HyperLinks.Add(worksheet.Range["C7"]);
hyperlink1.Type = ExcelHyperLinkType.Url;
hyperlink1.Address = "mailto:support@syncfusion.com";
hyperlink1.ScreenTip = "Send Mail to this id for your queries";

//Creating Hyperlink for Opening Files using type as File
IHyperLink hyperlink2 = worksheet.HyperLinks.Add(worksheet.Range["C9"]);
hyperlink2.Type = ExcelHyperLinkType.File;

hyperlink2.Address = @"..\..\";
hyperlink2.ScreenTip = "File path";
hyperlink2.TextToDisplay = "Hyperlink for files using File as type";

//Creating Hyperlink for Opening Files using type as Unc
IHyperLink hyperlink3 = worksheet.HyperLinks.Add(worksheet.Range["C11"]);
hyperlink3.Type = ExcelHyperLinkType.Unc;
hyperlink3.Address = @"C:\Program Files\Syncfusion\Essential Studio";
hyperlink3.ScreenTip = "Click here for files";
hyperlink3.TextToDisplay = "Hyperlink for files using Unc as type";

//Creating Hyperlink to another cell using type as Workbook
IHyperLink hyperlink4 = worksheet.HyperLinks.Add(worksheet.Range["C13"]);
hyperlink4.Type = ExcelHyperLinkType.Workbook;
hyperlink4.Address = "Sheet1!B21";
hyperlink4.ScreenTip = "Click here";
hyperlink4.TextToDisplay = "Click here to move to the cell with Comments about XlsIO";

IHyperLink hyperlink5 = worksheet.HyperLinks.Add(worksheet.Range["C15"]);
hyperlink5.Type = ExcelHyperLinkType.Workbook;
hyperlink5.Address = "Sheet1!B23";
hyperlink5.ScreenTip = "Click here";
hyperlink5.TextToDisplay = "Click here to move to the cell with Comments about this sample";

//Disabling Hyperlink using type as None
IHyperLink hyperlink6 = worksheet.HyperLinks.Add(worksheet.Range["C17"]);
hyperlink6.Type = ExcelHyperLinkType.None;
hyperlink6.ScreenTip = "Use this Address";
hyperlink6.TextToDisplay = "www.syncfusion.com";

Note: You can find the sample program in the Syncfusion Dashboard which you have installed.

Please let me know if there is any clarification.

Regards,

Johnson



Hi Navin_98c707bc.zip


SR Sridhar Syncfusion Team November 14, 2011 06:45 AM UTC

Hi Navin,

Please try the above given solution at your side and let us know if these helps you.

Please go through the following online doumentaion link for more details.

http://help.syncfusion.com/ug_94/Reporting/XlsIO/ASP.NET/default.htm?turl=Documents%2Flinks.htm

Please let me know if you require any further clarifications.

thanks,
Sridhar.S


Loader.
Live Chat Icon For mobile
Up arrow icon