【发布时间】:2011-01-17 01:39:31
【问题描述】:
我正在尝试将中文数据从数据库下载到 Excel。但是数据在 Excel 中以不同的字符出现,就像这样
œèŽžå¸‚è¯šé€šè®¡ç®—æœºæŠ€æœ¯å’¨è¯¢æœåŠ¡æœ‰é™å...¬å¸
这是我下载excel的代码。我不明白我的代码有什么问题。
dg.AllowPaging = False
dg.AllowSorting = False
dg.AllowCustomPaging = False
dg.AutoGenerateColumns = True
dg.HeaderStyle.Font.Bold = True
dg.HeaderStyle.Font.Underline = True
dg.DataSource = sqlDs.Tables(0)
dg.DataBind()
dg.RenderControl(htmlWrite)
Response.Clear()
Response.ClearContent()
Response.AddHeader("content-disposition", "attachment;filename=FullExtract_" & Now.Year.ToString & Now.Month.ToString & Now.Day.ToString & ".xls")
Response.ContentType = "application/octet-stream"
'Response.ContentType = "application/excel"
Response.BinaryWrite(System.Text.UnicodeEncoding.UTF8.GetBytes(stringWrite.ToString()))
Response.End()
【问题讨论】:
标签: c# .net asp.net vb.net excel