关于C# 将数值导入EXCEL 出现异常来自 HRESULT:0x800401A8

来源:百度知道 编辑:UC知道 时间:2024/09/27 17:30:13
高手啊,高手,回答一下吧,很着急哦

不知道你是否设置MIME,例如:
string attachment = "attachment; filename=Contacts.xls";

Response.ClearContent();

Response.AddHeader("content-disposition", attachment);

Response.ContentType = "application/ms-excel";

StringWriter sw = new StringWriter();

HtmlTextWriter htw = new HtmlTextWriter(sw);

GridView1.RenderControl(htw);

Response.Write(sw.ToString());

Response.End();
这样做了,在看你的Excel受否可以读取到,你试试吧

呵呵这个问题我也遇到过的,最好的办法就是查看你的应用程序日志,引起的原因很多,有可能是权限的 有可能是com 组件的问题!

图表的边界没有设置好