自己写了一个Dll文件
访问方法
using Db.RWM.Data;
DbRWMData myData = new DbRWMData();
DataSet mySet = my_web_userform_news.GetFieldList("*,(select A_Name from Guest_Address where a_id = O_Memo) as shouname,(select G_NAME from Guest_Info where g_id = o_GuestId) as username",sSql.ToString() + "order by O_CreateTime desc");
myData.WebExportDataSetToExcel(mySet,1);
直接导出DataSet ,如果查询的DataSet中没有你需要的列,请使用DataSet中的DataTable 进行添加自己的列,即可
前端调用:
就是直接调用接口2次即可自动下载文件
$.post( '<OutPut>DbveloperHelper.GetActionPath()</OutPut>list.aspx?action=list&isdaochu=1',function(callback){
location.href = '<OutPut>DbveloperHelper.GetActionPath()</OutPut>list.aspx?action=list&isdaochu=1';
});
结果如图:

本文介绍了一种使用自定义DLL文件将DataSet直接导出到Excel的方法,包括代码实现细节和前端调用接口的示例,展示了如何处理复杂的数据转换需求。
542

被折叠的 条评论
为什么被折叠?



