繁体   English   中英

如何在我的C#代码中从HTML网格下载到excel或CVS文件

[英]How to do download from html grid to excel or CVS file in my c# code

我正在写一个应该充当机器人的Windows服务。 它应该转到网页并进行一些活动,例如登录,然后按一个按钮以从另一端获取一些记录。

现在,我几乎已完成所有工作,并且记录已从服务器获取。

但是我不知道如何使用c#和.net框架将记录从HTML网格下载到Excel或CVS本地文件中。 问题是:如何使用.net Framework从html网格下载到本地文件,我不使用asp.net,它只是Windows服务

****on click of the button you can dowload the excel****       

 protected void btn_download_template(object sender, EventArgs e)
        {
            string str_FolderPath = "c:/Budget_Sample.xlsx";
            Response.ContentType = ContentType;
            Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(str_FolderPath));
            Response.WriteFile(str_FolderPath);
            Response.End();
        }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM