Showing posts with label exporting. Show all posts
Showing posts with label exporting. Show all posts

Friday, March 30, 2012

How to remove the header underline in excel

when exporting to excel - the rendering adds an underline to the header, is
there a way so that when exporitng a report to excel that it does not do this?the report header that is...not column headings...
"ultra ak" wrote:
> when exporting to excel - the rendering adds an underline to the header, is
> there a way so that when exporitng a report to excel that it does not do this?

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