A
aSoundMind
Hello Guys,
I am not sure is this a common problem. I can't display image which in
a gridview to excel or word. I have not try on pdf or web but surely
this annoy me.
I tried to google it and the best I can found is this code which
mentioned something tat it is due to excel limitation and so we need
to use absolute path.
So here is the code, which I modified a bit to match my code.
Dim stringWrite As System.IO.StringWriter = New
System.IO.StringWriter
Dim htmlWrite As System.Web.UI.HtmlTextWriter = New
HtmlTextWriter(stringWrite)
Dim warnImage As New Image
warnImage = FormView1.FindControl("warnImg")
Dim path As String = ""
warnImage.ImageUrl = path
stringWrite.Write("<img src=" &
HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) &
HttpContext.Current.Request.ApplicationPath & "/" & warnImage.ImageUrl
& " />")
warnImage.RenderControl(htmlWrite)
So I tried tat code and still the image is not shown. No error
whatsoever. I appreciate any help. Thanks in advance.
I am not sure is this a common problem. I can't display image which in
a gridview to excel or word. I have not try on pdf or web but surely
this annoy me.
I tried to google it and the best I can found is this code which
mentioned something tat it is due to excel limitation and so we need
to use absolute path.
So here is the code, which I modified a bit to match my code.
Dim stringWrite As System.IO.StringWriter = New
System.IO.StringWriter
Dim htmlWrite As System.Web.UI.HtmlTextWriter = New
HtmlTextWriter(stringWrite)
Dim warnImage As New Image
warnImage = FormView1.FindControl("warnImg")
Dim path As String = ""
warnImage.ImageUrl = path
stringWrite.Write("<img src=" &
HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) &
HttpContext.Current.Request.ApplicationPath & "/" & warnImage.ImageUrl
& " />")
warnImage.RenderControl(htmlWrite)
So I tried tat code and still the image is not shown. No error
whatsoever. I appreciate any help. Thanks in advance.