Hi!
I use this code to export the contents og a gridview to MS Excel:
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
I use this code to export the contents og a gridview to MS Excel:
Code:
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