使用asp.net创建xls文件时渲染Acute重音符

时间:2015-02-02 16:33:23

标签: c# asp.net excel xls

当我创建具有急性重音的xls文件时,请在Excel文件中执行此操作: Número,但正确的词是“Número”。

我有这段代码:

                    HtmlForm form = new HtmlForm();
                    string attachment;
                    if (Request.QueryString["AutorizacionAcceso"] != null)
                    {
                        attachment = "attachment; filename=AutorizaciónAcceso.xls";
                    }
                    else
                    {
                        attachment = "attachment; filename=segmentacionMundoNet.xls";
                    }

                    Page.Form.Target = "_blank";
                    Page.Response.ClearContent();
                    Page.Response.AddHeader("content-disposition", attachment);
                    Page.Response.ContentType = "application/ms-excel";
                    Page.Response.Charset = Encoding.UTF8.WebName;
                    StringWriter stw = new StringWriter();
                    HtmlTextWriter htextw = new HtmlTextWriter(stw);
                    form.Controls.Add(gvResultados);
                    this.Controls.Add(form);
                    form.RenderControl(htextw);
                    Page.Response.Write(stw.ToString());
                    Page.Response.End();

我如何实现这一目标?

1 个答案:

答案 0 :(得分:1)

将ú替换为此字符串“& uacute;” (&和uacute之间没有分离。

Here is a listing特殊字符代码

看看这个page,虽然是西班牙语