Imagen a excel asp.net
Hola experto:
Quisiera que me ayudes, deseo exportar una imagen a excel desde asp.net , tengo este codigo, me exporta el data a un excel correctamente, pero quiero agregarle el logo en la celda (a1) de mi hoja excel que esta exportando, como haria???, espero pueedas ayudarme,
Gracias
Protected Sub ImgbtnExportar_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImgbtnExportar.Click
Dim sb As StringBuilder = New StringBuilder()
Dim SW As System.IO.StringWriter = New System.IO.StringWriter(sb)
Dim htw As HtmlTextWriter = New HtmlTextWriter(SW)
Dim Page As Page = New Page()
Dim form As HtmlForm = New HtmlForm()
Dim strFile As String = ""
strFile += "Reporte_Usuario_" & Now.ToShortDateString.Replace("/", "")
strFile += "_" & Right("00" & Now.Hour.ToString, 2)
strFile += Right("00" & Now.Minute.ToString, 2)
strFile += Right("00" & Now.Second.ToString, 2)
strFile += ".xls"
Me.grdUsuxMunicipalidad.EnableViewState = False
Page.EnableEventValidation = False
Page.DesignerInitialize()
Page.Controls.Add(form)
form.Controls.Add(Me.grdUsu)
Page.RenderControl(htw)
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment;filename=" & strFile)
Response.Charset = "UTF-8"
Response.ContentEncoding = Encoding.Default
Response.Write(sb.ToString())
Response.End()
End Sub
Quisiera que me ayudes, deseo exportar una imagen a excel desde asp.net , tengo este codigo, me exporta el data a un excel correctamente, pero quiero agregarle el logo en la celda (a1) de mi hoja excel que esta exportando, como haria???, espero pueedas ayudarme,
Gracias
Protected Sub ImgbtnExportar_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImgbtnExportar.Click
Dim sb As StringBuilder = New StringBuilder()
Dim SW As System.IO.StringWriter = New System.IO.StringWriter(sb)
Dim htw As HtmlTextWriter = New HtmlTextWriter(SW)
Dim Page As Page = New Page()
Dim form As HtmlForm = New HtmlForm()
Dim strFile As String = ""
strFile += "Reporte_Usuario_" & Now.ToShortDateString.Replace("/", "")
strFile += "_" & Right("00" & Now.Hour.ToString, 2)
strFile += Right("00" & Now.Minute.ToString, 2)
strFile += Right("00" & Now.Second.ToString, 2)
strFile += ".xls"
Me.grdUsuxMunicipalidad.EnableViewState = False
Page.EnableEventValidation = False
Page.DesignerInitialize()
Page.Controls.Add(form)
form.Controls.Add(Me.grdUsu)
Page.RenderControl(htw)
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment;filename=" & strFile)
Response.Charset = "UTF-8"
Response.ContentEncoding = Encoding.Default
Response.Write(sb.ToString())
Response.End()
End Sub
1 Respuesta
Respuesta de Roberto Alvarado