I suggest you to add hyperlinks in sql query itself when you are forming table columns like below.
SELECT '<a href="'
+ HyperLink
+ '">'
+ TextLink
+ '</a>'
FROM YourTable
<or>
public bool ExportToHtml(out string path)
{
DataTable dt = ToDataTable(_collection,_selectedColumns);
StringBuilder strHTMLBuilder = new StringBuilder();
strHTMLBuilder.Append("<html >");
strHTMLBuilder.Append("<head>");
strHTMLBuilder.Append("</head>");
strHTMLBuilder.Append("<body>");
strHTMLBuilder.Append("<table border='1px solid black' cellpadding='1' cellspacing='1' bgcolor='LightYellow' style='font-family:Garamond; font-size:medium; width=100%'>");
strHTMLBuilder.Append("<tr width=100% >");
foreach (DataColumn myColumn in dt.Columns)
{
strHTMLBuilder.Append("<td style='font-size:medium; font-weight:bold;width=100%; padding-right: 30px' >");
strHTMLBuilder.Append(<big><pre>"<a href='"HyperLink"'>'"myColumn.ColumnName"'</a>"
);
strHTMLBuilder.Append("");
}
strHTMLBuilder.Append("");
foreach (DataRow myRow in dt.Rows)
{
strHTMLBuilder.Append("");
foreach (DataColumn myColumn in dt.Columns)
{
strHTMLBuilder.Append("");
strHTMLBuilder.Append(myRow[myColumn.ColumnName].ToString());
strHTMLBuilder.Append("");
}
strHTMLBuilder.Append("");
}
//Close tags.
strHTMLBuilder.Append("");
strHTMLBuilder.Append("");
strHTMLBuilder.Append("");
string Htmltext = strHTMLBuilder.ToString();
path = string.Format("{0}\\{1}.{2}", _basepath, _filename, "html");
System.IO.File.WriteAllText(path, Htmltext);
//return Htmltext;
return true;
}
Please up vote if this solution helps.