注册 登录
编程论坛 ASP.NET技术论坛

把统计表导到excel出现乱码

水晶心 发布于 2010-10-08 13:20, 496 次点击
public void OutExcel()
    {
        //Excel文件名
        string fileName = DateTime.Now.ToString("yyyy-MM-dd") + "考勤报表.xls";
        Response.Clear();
        Response.Buffer = true;
        //对文件名进行编码
        Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
        Response.ContentEncoding = System.Text.Encoding.UTF8;
        Response.ContentType = "application/vnd.ms-excel";
        this.EnableViewState = false;
    }
    #endregion
}

把统计后的表格导到excel总是出现乱码,求高手帮我解决
1 回复
#2
yms1232010-10-09 13:10
用gb2312编码呢?
1