首页 > 其他 > 详细

导出excel

时间:2017-03-21 15:47:57      阅读:175      评论:0      收藏:0      [点我收藏+]

/// <summary>
/// 导出
/// </summary>
/// <param name="magnetic_CheckPointTemplatesB_OID"></param>
/// <param name="httpResponse"></param>
private void Export(HttpResponse httpResponse,DataTable dt)
{
try
{
dt.TableName = "auto_price_list";
WorkbookDesigner wd = new WorkbookDesigner();
string templateFileName = HttpContext.Current.Server.MapPath("\\模板.xlsx");
wd.Open(templateFileName);
wd.SetDataSource(dt);
wd.Process();
wd.Save(string.Format("导出名称.xls"), SaveType.OpenInExcel, FileFormatType.Excel2003, httpResponse);
httpResponse.Flush();
httpResponse.Close();
httpResponse.End();
}
catch(Exception ex)
{

}

}

导出excel

原文:http://www.cnblogs.com/wangnengduo/p/6594395.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!