博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Asp.NET导出Excel文件乱码解决方法
阅读量:4590 次
发布时间:2019-06-09

本文共 688 字,大约阅读时间需要 2 分钟。

HttpContext.Current.Response.Clear();         HttpContext.Current.Response.Buffer = true;         HttpContext.Current.Response.Charset = "GB2312"; this.Page.Response.Write("
");//解决乱码问题 HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("日常保养记录" + ".xls")); HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); HttpContext.Current.Response.ContentType = "application/ms-excel"; HttpContext.Current.Response.Write(this.outputstr.Value);//写入excel HttpContext.Current.Response.End();

 

转载于:https://www.cnblogs.com/abenmao/archive/2012/03/31/2426737.html

你可能感兴趣的文章
ajax调用servlet
查看>>
IText 生成横向的doc文档
查看>>
认识了个外国友人!
查看>>
对Cookie进行增删改查
查看>>
MySQL sql语句获取当前日期|时间|时间戳
查看>>
微信支付官方SDK V3 .NET版的坑
查看>>
Python(一)list tuple dict set
查看>>
什么是死锁,简述死锁发生的四个必要条件,如何避免与预防死锁
查看>>
hdu4651(广义五边形数 & 分割函数1)
查看>>
python iter,迭代器&dict,字典详解
查看>>
python笔记1
查看>>
C语言:自定义一个查找字串的功能函数,类似于<string.h>中的strstr()
查看>>
数据库联系 创建表格:重点
查看>>
Regist
查看>>
设置磁盘配额(第二版)
查看>>
[转]asp.net 防止外部提交数据
查看>>
android用户界面之Gallery3D学习资料汇总
查看>>
[编写高质量代码:改善java程序的151个建议]建议62 警惕数组的浅拷贝
查看>>
h5移动端适配iOS遇到的问题
查看>>
20. 最长公共子串(ToDo)[LCS]
查看>>