创建Excel文件时无效的字符集(语言环境代码) [英] Invalid character set (locale code) when an Excel file is created

查看:67
本文介绍了创建Excel文件时无效的字符集(语言环境代码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在尝试使用ASP.NET/C#创建一个Excel文件.为此,我使用以下代码:

Hi there,

I'm trying to create an Excel file using ASP.NET/C#. To do that, I'm using the following code:

public partial class Report_Generic : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Session.LCID = 1046;
            Library library = new Library(Session["language"].ToString(), Session["country"].ToString());

            Response.ContentType = "application/ms-excel";
            Response.AddHeader("Content-Disposition", "inline;filename=" + Session["core_id"].ToString() + " - " + library.getLabel("report") + ".xls");

            Reprot_Lib report = new Reprot_Lib(Session["language"].ToString(), Session["country"].ToString());
            report.loadReport(tblMain, Request.Form["hfFields"].Trim(), Request.Form["ddlOrganization"].Trim(), Request.Form["ddlCustomer"].Trim(), Request.Form["txtNf"].Trim(), Request.Form["txtSo"].Trim(), Request.Form["ddlStatuses"].Trim(), Request.Form["txtCommercialInvoice"].Trim(), Request.Form["txtCity"].Trim(), Request.Form["ddlState"].Trim());
        }
    }

我的问题:打开Excel文件时,所有带有重音的单词都显示为奇数字符.例如:série一词被改成Série.

你知道我该怎么解决吗?



注意:如果很抱歉,这不是发布此帖子的更好的论坛.您能指出那个是什么吗?





谢谢您,
路易斯·安东尼奥

My issue: when the Excel file is opened all words which have accent are been display odd characters. For example: the word série is been diplayed as Série.

Do you know how can I fix it?



Note: If this is not the better group to post it, I'm sorry. Could you please indicate what is that one?





Thank you,
Luis Antonio

推荐答案

感谢您的帖子!不幸的是,目前没有论坛来发布您要提问的问题,因此我建议您将问题发布到以下Microsoft.public.excel.programming新闻组之一: 希望有帮助!


这篇关于创建Excel文件时无效的字符集(语言环境代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆