我目前在我的 ASP .NET 应用程序中使用 Visual Studio 2008。我正在尝试通过 Response 对象将一些带有日语字符的报告导出到 Excel。当我尝试导出时,所有的日文字符看起来都是乱码。它适用于汉字。这是我尝试过的:
我试过 Installed Japanese Language Pack / Encoding to UTF-8 / UTF-7 / Shift-JIS / Globalization (Web.Config) ..但没有运气。有什么想法可以解决这个问题吗?谢谢 !!
string attachment = "attachment; filename=PerksPlusReport.xls";
//Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("content-disposition", attachment);
//Response.Charset = "UTF-8";
//Response.Charset = "UTF-7";
//Response.Charset = "Shift_JIS";
Response.ContentType = "application/vnd.ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
// Create a form to contain the grid
HtmlForm frm = new HtmlForm();
ReportGridView.Parent.Controls.Add(frm);
frm.Attributes["runat"] = "server";
GridView GridView2 = …Run Code Online (Sandbox Code Playgroud)