乱码问题

Bandlass 2006-05-03 04:51:59
在把DataGrid中的数据导入excel表格时,excel表格会出现乱码,请高人指点,谢谢
...全文
120 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Bandlass 2006-05-09
  • 打赏
  • 举报
回复
B/S模式,C#写的后台代码
SeeSunSet 2006-05-03
  • 打赏
  • 举报
回复
HttpContext.Current.Response.Charset = "gb2312"
SeeSunSet 2006-05-03
  • 打赏
  • 举报
回复
你是BS还是CS啊?

HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=Excel.xls")
Response.ContentType = "application/vnd.ms-excel"
HttpContext.Current.Response.Charset = ""
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default
DataGrid1.Page.EnableViewState = False
Dim tw As StringWriter = New StringWriter()
Dim hw As New HtmlTextWriter(tw)
DataGrid1.Visible = True
DataGrid1.RenderControl(hw)
HttpContext.Current.Response.Write(tw.ToString())
HttpContext.Current.Response.End()

111,092

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧