Quantcast
Channel: Exportar GridView a EXCEL!!!!!!!!!!
Viewing all articles
Browse latest Browse all 3

Exportar GridView a EXCEL!!!!!!!!!!

$
0
0

Hola, supongo q exportar el grid asi:

Dim swriter As New StringWriter()
        Dim hwriter As New HtmlTextWriter(swriter)
        Dim frm As New HtmlForm()
        Try
            With oControl
                oPage.Response.Clear()
                oPage.Response.ContentType = "application/vnd.xls"
                oPage.Response.AddHeader("content-disposition", "attachment;filename=grid.xls")

                .Parent.Controls.Add(frm)
                frm.Attributes("runat") = "server"
                frm.Controls.Add(oControl)
                frm.RenderControl(hwriter)
                oPage.Response.Write(swriter.ToString())
                oPage.Response.End()
            End With

 

el problema es q al hacerlo asi no estas trabajando como tal con excel, si quieres controlar hojas, libros y demas, necesitas acceder al componente com de excel, agregar referencias a interop de excel y trabajr con el...

revisa esto: http://www.microsoft.com/downloads/details.aspx?familyid=5272e1d1-93ab-4bd4-af18-cb6bb487e1c4&displaylang=en

es el sdk de excel.. espero te sirva, sino comenta y seguimos mirando q hacer


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images