C#Excel 2007错误
我有一个像这样的简单代码。此代码只是将gridwiev导出到excel文件..
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=cat5.xls");
Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1254");
//Response.ContentEncoding = System.Text.Encoding.UTF7;
Response.Charset = "windows-1254";
//Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.ContentType = "application/vnd.ms-excel";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GridView1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
但我们公司的一些用户使用Excel 2003,一些用户使用Excel 2007.当我运行此代码时,Excel 2003没有问题。但Excel 2007中有一些问题就像这些图片一样。
我怎么解决这个问题?有没有人有想法?
最好的祝福,
Soner。
没有找到相关结果
已邀请:
2 个回复
旅牢斯讲
垫歌蝎降凤