/// <summary> /// 依据tr对应json数据,导出相应Execl /// </summary> /// <param name="trjson">trjson数据</param> /// <param name="filename">文件地址</param> /// <returns>生成文件下载地址</returns> public string ExportTable(string filename, string trjson) { string name = "/upfile/" + filename + DateTime.Now.ToString("yyyyMMddmmss") + ".xls"; bool Result = HtmlTableExport.RenderToExcel(trjson, base.Server.MapPath("~/" + name)); return(Result ? name : "NO:生成Execl失败!"); }
protected void Btn_Export_Click(object sender, EventArgs e) { string value = this.HidHtmlTableJson.Value; HtmlTableExport.RenderToExcel(value, base.Server.MapPath("~/upfile/数据文档" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xls")); }