【问题标题】:How to do download from html grid to excel or CVS file in my c# code如何在我的 c# 代码中从 html 网格下载到 excel 或 CSV 文件
【发布时间】:2016-09-20 19:54:37
【问题描述】:

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

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

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

【问题讨论】:

  • 其实我的html文档里有记录
  • 您使用什么框架连接到网站?网站上是否有按钮可以下载其他格式的值?
  • 我正在使用 awsoemium,有一个按钮可以导出,还有一个单选按钮可以在 cvs 和 excel 之间进行选择,但我是新手,不知道如何才能知道该做什么

标签: c# html .net excel download


【解决方案1】:
****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();
        }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-01
    • 2010-10-10
    • 1970-01-01
    • 2015-05-28
    • 1970-01-01
    相关资源
    最近更新 更多