• 实现下载完成


    RouteConfig里面加一个

    routes.MapRoute(
    name: "Download",
    url: ""
    );

    然后用ajax 访问Execl 运行的

    public string OutAllCompany()
    {
    Dictionary<string, string> execl = new Dictionary<string, string>()
    {
    {"CoId","公司ID" },
    {"CoName","公司名称" },
    {"CoCompanytype","公司性质" },
    {"CoRemark","备注" },
    {"CoCreateddate","创建时间" },
    {"CoCreateUsId","创建人" },
    {"CoUptUsid","修改人" },
    {"CoUptDate","修改时间" },
    {"CoIsdeleted","是否删除" },
    {"CoDelUsId","删除人" },
    {"CoDelDate","删除时间" },
    {"CoAddress","公司地址" }
    };

    string CompanyInfo = Client.GetApi("http://localhost:54098/api/", ResuFull.get, "Company/GetCompany");
    List<Company> list = JsonConvert.DeserializeObject<List<Company>>(CompanyInfo);
    string url = ExcelHelper.EntityListToExcel2003(execl,list, "公司信息表");

    return Url.RouteUrl("Download")+url;//************************************
    }

    function DaoChu() {
    $.ajax({
    url: "/Company/OutAllCompany",
    success: function (data) {
    location.href = data;
    }
    })
    }

  • 相关阅读:
    什么是封装?
    table
    POM文件
    Maven环境的搭建
    什么是maven
    J2EE的三层经典结构
    DOM对象和jQuery对象对比
    jQuery常用选择器分类
    什么是JQuery?它的特点是什么?
    jQuery准备函数语法
  • 原文地址:https://www.cnblogs.com/Kirins/p/10517749.html
Copyright © 2020-2023  润新知