小编Kal*_*yan的帖子

Asp.Net 导出到 Excel - 日语字符

我目前在我的 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)

c# asp.net unicode export-to-excel

1
推荐指数
1
解决办法
5668
查看次数

标签 统计

asp.net ×1

c# ×1

export-to-excel ×1

unicode ×1