我编写了下载excel文件的代码。此文件大小很大(超过2 MB)。 在应用程序中,我想在下载时显示PROGRESS BAR。怎么实现呢? 我的下载代码如下
private void DownloadFile(string getpathfromappconfig, string FileName)
{
string path = @getpathfromappconfig + "\\" + FileName + ".xlsx";
System.IO.FileInfo file = new System.IO.FileInfo(path);
string Outgoingfile = FileName + ".xlsx";
if (file.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + Outgoingfile);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.WriteFile(file.FullName);
}
else
{
Response.Write("This file does not exist.");
}
}
我应该在哪里以及如何显示进度条?
提前致谢。