Bonjour tout le monde
j'utilise ce code pour exporter le contenu d'un gridview vers excel.
l'export se fait bien sans erreur, mais lorsque j'ouvre mon fichier je trouve que excel n'affiche pas bien les caractères accentués.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 string nomFichier = string.Concat("export_", serie, "_fichier.xls"); string attachment = string.Concat("attachment; filename=", nomFichier); Response.ClearContent(); Response.AddHeader("content-disposition", attachment); Response.ContentType = "application/ms-excel"; Response.Charset = "UTF-8"; StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); gridView.RenderControl(htw); Response.Write(sw.ToString()); Response.End();
je note que j'utilise l'encodage "UTF-8" dans la page d'export.
y a t il une solution pour ce problème ?
Merci.
Partager