troubleshooting Question

Export Data into excel in excel 2007 format(xlsx)

Avatar of j1981
j1981Flag for India asked on
.NET ProgrammingASP.NETVisual Basic.NET
13 Comments1 Solution1003 ViewsLast Modified:
How can I export  data  in .xlsx file format(MSExcel 2007).
Currently I could do it in MSExcell 2003 format (.xls).
I tried by putting .xlsx in
 Response.AddHeader("content-disposition", "attachment;filename=sample.xlsx") ... But this will be a corrupted file.

Desired Fix:
 I want to export data in .xlsx (MS Excel 2007) format.
private sub ExportToExcel()

	dim htmlString AS string
	htmlString = "<HTML></TABLE><tr><td>My Data</td></tr></TABLE></HTML>")
	Response.Buffer = True
	Response.AddHeader("content-disposition", "attachment;filename=sample.xls")
	Response.Charset = ""
	Response.ContentType = "application/"

End sub

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros