首页 > 代码库 > 导出excel
导出excel
/// <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