Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to export image which is displayed on web page. This image is stored in Sql image data type. While displaying image I am converting the image to Base64String.
VB
Image1.ImageUrl = "data:image/jpg;base64," & Convert.ToBase64String(imgPhoto)

While exporting page, image is not displaying in word document file.

I can not store image on the server because of security reason.
below code is for export to word file.
VB
Response.AddHeader("content-disposition", "attachment;filename=Test.doc")
        Response.Cache.SetCacheability(HttpCacheability.NoCache)
        Response.ContentType = "application/ms-word "
        Response.Charset = ""
        Dim stringWrite As New System.IO.StringWriter()
        Dim htmlWrite As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringWrite)

        ' Create a form to contain the grid
        ControlID.RenderControl(htmlWrite)

        Dim stringWrite1 As New System.IO.StringWriter()
        Dim htmlWrite1 As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringWrite1)

        ' Create a form to contain the grid
        ImageLogo.RenderControl(htmlWrite1)

        Response.Write(stringWrite1.ToString() & stringWrite.ToString())
        Response.[End]()
Posted
Updated 21-Nov-14 23:43pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900