Showing posts with label hyperlink. Show all posts
Showing posts with label hyperlink. Show all posts

Wednesday, March 28, 2012

How to remove Hyperlink from column while exporting to excel

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

Monday, March 26, 2012

How to Remove a charater from a SQL Data.

Dear Frineds

I have a hyperlink datatype column in Access database.I import that column into SQL Table.

Now my column in sql table say 'imp_cl 'have all data from Acces table.
But all record are prefix with"#" and at the end of value also have "#".
that means it imported in following way

eg. #//Server/image/img1.pdf#

Now I want to remove this # from both side.As we have around 80,000 record of same type,it is very difficult to do it record by record.

I would like to know aay fuction ,method or programme to remove this "#" from all record.

Thannk you

gracesonDECLARE @.c NVARCHAR(200)

SET @.c = '#//Server/image/img1.pdf#'

SELECT DataLength(@.c), @.c, SubString(@.c, 2, Datalength(@.c) / 2 - 2)
-PatP