如何从网页下载Excel [英] How to download Excel from Webpage
本文介绍了如何从网页下载Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用COM dll下载excel。我能够使用excel.Visible = true生成excel; excel.UserControl = true;在开发环境中。但是一旦我部署到IIS,我就无法在客户机上导出excel。
请帮帮我怎么办?
Hi,
I am trying to download excel using COM dll. I am able to generate excel using excel.Visible = true; excel.UserControl = true; within the development environment. But once I deployed into IIS I am unable to export excel at client machine.
Please help me in how can I do it?
推荐答案
您可以使用以下命令下载任何文件
Hi,
You can download any file using following command
public void DownloadFile(string filePath)
{
if (File.Exists(Server.MapPath(filePath)))
{
string strFileName = Path.GetFileName(filePath).Replace(" ", "%20");
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + strFileName);
Response.Clear();
Response.WriteFile(Server.MapPath(filePath));
Response.End();
}
}
访问这里....
download-and-excel-file- from-an-aspx-webpage [ ^ ]
visit here....
download-and-excel-file-from-an-aspx-webpage[^]
这篇关于如何从网页下载Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文