Something like this... I think that in WindowsForm is totally different --->
Response.ContentType = "application/vnd.ms-excel" Response.AddHeader("Content-Disposition", "filename=Report.xls;") Response.Charset = "" Response.Buffer = False Me.EnableViewState = False
Dim tw As New System.IO.StringWriter() Dim hw As New System.Web.UI.HtmlTextWriter(tw)
' tell the grid to render itself into the html text writer grdReport.RenderControl(hw)
Dim strHtml As String = tw.ToString Dim iLoop As Int32 Dim Multiple As Int32 = Fix(strHtml.Length / 1000)
' now write the contents of the html string to the client For iLoop = 0 To Multiple Response.Write(Mid(strHtml, (100000 * iLoop) + 1, 100000)) Response.Flush() Next
Response.End() |