ASP.NET导出Excel乱码的解决方案

来源:互联网 发布:婚礼快剪用什么软件 编辑:程序博客网 时间:2024/05/06 08:38

在asp.net中导出excel 中比较通行的做法是: Response.ContentType = "application/vnd.ms-excel";
然后直接向里面扔 html 的table
但是有中文的时候 老出现乱码,有很多解决方案,但都不能通盘解决, 就是在 输出html两头输出

 

Response.Write("<html><head><meta http-equiv=Content-Type content=/"text/html; charset=utf-8/">");

Response.Write("</body></html>");

 

或者

 

<meta http-equiv="content-type" content="application/ms-excel; charset=UTF-8"/>
<table>
    <tr>
        <td>cbcye@live.com </td>
 <td>sky.com </td>
    </tr>
<table>

原创粉丝点击