noccy Posted January 10, 2006 Posted January 10, 2006 Hi! I use this code to export the contents og a gridview to MS Excel: Protected Sub btnExport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExport.Click Response.Clear() Response.AddHeader("content-disposition", "attachment;filename=FileName.xls") Response.Charset = "" ' If you want the option to open the Excel file without saving than ' comment out the line below ' Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.xls" Dim stringWrite As System.IO.StringWriter = New System.IO.StringWriter() Dim htmlWrite As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringWrite) GVInsert.RenderControl(htmlWrite) Response.Write(stringWrite.ToString()) Response.End() End Sub This works fine, but my norwegian lettes, æ, ø and å is messed up... I guess i might have something to do with the charset, but i don't know what... noccy Quote
Cags Posted January 10, 2006 Posted January 10, 2006 Does this help.. http://forum.ezos.com/ShowPost.aspx?PostID=998&ForumID=4 Quote Anybody looking for a graduate programmer (Midlands, England)?
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.