form导出excel出现乱码问题

form导出excel出现乱码问题,是有没有添加meta信息造成的。
添加
<meta http-equiv=\"content-type\" content=\"application/vnd.ms-excel; charset=utf-8\"/>

控制输出页面内容的编码方式,则没有乱码了。

示例代码:

 

var st = "<meta http-equiv=\"content-type\" content=\"application/vnd.ms-excel; charset=utf-8\"/>";
System.Web.HttpContext.Current.Response.Output.Write(st + ExcelContent);

  

posted @ 2018-06-29 16:56  viola  阅读(694)  评论(0编辑  收藏  举报