웹 페이지에 표시되는 이미지를 내보내려고합니다. 이 이미지는 Sql 이미지 데이터 형식으로 저장됩니다. 이미지를 표시하는 동안 이미지를 Base64String으로 변환합니다.이미지를 Word 문서 파일에 SQL 서버에서 삽입
Image1.ImageUrl = "data:image/jpg;base64," & Convert.ToBase64String(imgPhoto)
페이지를 내보내는 동안 이미지가 워드 문서 파일에 표시되지 않습니다.
보안상의 이유로 서버에 이미지를 저장할 수 없습니다. 코드 아래의 은 단어 파일로 내보내기 용입니다.
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]()