Public Shared Sub ExportToExcel(ByVal objViewcreator As ViewCreatorGeneral, ByVal dtFromDatabase As DataTable, ByVal inColumnArrList As ArrayList, ByVal report_header As String, ByVal originalSort As String)
System.Web.HttpContext.Current.Response.ClearContent()
System.Web.HttpContext.Current.Response.ClearHeaders()
System.Web.HttpContext.Current.Response.Charset = ""
System.Web.HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "inline; filename=report.xls")
System.Web.HttpContext.Current.Response.AddHeader("Pragma", " private")
System.Web.HttpContext.Current.Response.AddHeader("Cache-control", " private, must-revalidate")
'writing tab separated stuff here
Dim tabFile As String = "my tab separted cols crlf separeted rows"
System.Web.HttpContext.Current.Response.BinaryWrite(Encoding.GetBytes(tabFile))
System.Web.HttpContext.Current.Response.End()
End Sub
more...
No comments:
Post a Comment