Try
Dim attachment As String = "attachment; filename=DataReport.xls"Response.ClearContent()Response.AddHeader("content-disposition", attachment)Response.ContentType = "application/ms-excel"Dim sw As StringWriter = New StringWriter()Dim str As String = sb.ToStringResponse.Write(str.ToString())Response.Flush()Response.End()
Catch ex As Exception
Throw ex
End Try
In this str variable has html mark. Using this code i am able to generate excel file but it is showing open/save dialog. User should not see this dialog and the generated excel should be saved to a given location.
Bikesh SrivastavaPosted Aug 12, 2016, 5:59 AM