特殊符号如(▲)导到EXCEL中产生乱码

处理方法

1.在前台页面▲加上 。

2.在后台强制下转换编码格式

 protected void ExportToExcel_Click(object sender, EventArgs e)
    {
        BindExportData();
        string attachment = "attachment; filename = MarkdownPerformanceOfAllSkuReport.xls";
        Response.ClearContent();
        Response.AddHeader("content-disposition", attachment);
        StringWriter stringWriter = new StringWriter();
        HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
        ResultTable.RenderControl(htmlTextWriter);
        Response.ContentType = "application/ms-excel";
        Response.Write("<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">");
        Response.Write(stringWriter.ToString());
        Response.End();
    }

posted @ 2011-06-16 15:42  scott.pei  阅读(2218)  评论(0编辑  收藏  举报