Hi,
I have one report with few of columns as hyperlinks leading to subreports. When report exported to Excel, columns which are hyperlinks exported and these hyperlinks still present in Excel and is not causing some problem as relative links are used in hyperlinks in main report. So, is there any way to remove hyperlinks from report while exporting to Excel?
I found a sort of work around for this.
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Dim sw As StringWriter = New StringWriter()
Dim htmlTextWriter As HtmlTextWriter = New HtmlTextWriter(sw)
ph.RenderControl(htmlTextWriter)
Dim sTemp As String = sw.ToString
sTemp = sTemp.Replace("href=", "")
Response.Write(sTemp)
Response.End()
Basically whatever you are giving the response.write to output, modify the string by taking out "href=". Even though there is still part of the <a> tag still there, excel seems to ignore it and just display the text.
Hope this works for you!!
And if it does work for, please mark this post as answer!!
Rob
sql
No comments:
Post a Comment