I am trying to export DataGrid into Excel 2007 in my asp.net application. I am using code below.
Response.Write("<meta http-equiv=Content-Type content='text/html; charset=utf-8'>")
Response.AppendHeader("Content-Disposition", "attachment; filename=" & dt.TableName & ".xlsx")
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.Charset = ""
Me.EnableViewState = False
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
dtResult = dt
Table.DataSource = dt
But I am getting the following error when I try to open the Excel sheet....
Excel cannot open the file fileName.xlsx because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matched the format of the file.
Above code is working fine for the Excel 2003 format. I just change two lines in above code for Excel 2003
Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…