Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image disapear when page is exported to word 1

Status
Not open for further replies.

taree

Technical User
May 31, 2008
316
US
I have a gridview and an image header in my page and when i export the gridview and the image header to word document. the image header disapear when I open the word document.Am I doing it right or is there a best way to handle this kind of problem. please let me know and your help is really appreciated.

Code:
<asp:Panel ID="pnlLogo" runat="server"   Width="100%" style="text-align: center">
            <img src="../images/ES-DSR.jpg"  alt="Mn/DOT Logo" runat="server" />
        </asp:Panel><br />

  Protected Sub btnWord_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnWord.Click
        Response.Clear()
        Response.ContentType = "application/ms-word"
        Response.AddHeader("Content-Disposition", "inline;filename=TechnicalMemorandum.doc")
        Response.Charset = ""
        Response.Cache.SetCacheability(HttpCacheability.NoCache)
        Dim stringWrite As StringWriter = New StringWriter
        Dim htmlWrite As HtmlTextWriter = New HtmlTextWriter(stringWrite)
        pnlLogo.RenderControl(htmlWrite)
        pnlInstruction.RenderControl(htmlWrite)
        pnlSignature.RenderControl(htmlWrite)
        Response.Write("<BR>")
        gvReviewer.RenderControl(htmlWrite)
        pnlApprove.RenderControl(htmlWrite)
        pnlMemo.RenderControl(htmlWrite)
        pnlExplain.RenderControl(htmlWrite)
        Response.Write(stringWrite.ToString())
        Response.End()


    End Sub
 
Maybe the word document is using the src attribute to locate the image. If that is the case then the document may not be able to access the image. this could be due either:
1. the use of a relative path vs. an absolute path
2. permission/access rights when attempting to load the remote image
3. something else

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Thank you Jason.As soon as I put the full path the image appears.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top