protected void btnExportOut_Click(object sender, EventArgs e) { try { DataTable exportData = new DataTable(); exportData.Columns.Add("主叫号码", typeof(string)); exportData.Columns.Add("被叫号码", typeof(string)); exportData.Columns.Add("接听时间", typeof(string)); exportData.Columns.Add("呼叫类型", typeof(string)); exportData.Columns.Add("工作单类型", typeof(string)); exportData.Columns.Add("地址", typeof(string)); exportData.Columns.Add("座席员", typeof(string)); exportData.Columns.Add("来电内容", typeof(string)); exportData.Columns.Add("解决方案", typeof(string)); string SqlWhere = " 1=1 "; StandardData dataObjectWorkCard = new StandardData("WorkCard"); DataTable dtWorkCard = dataObjectWorkCard.GetDataTable(-1, -1, SqlWhere, "", "*"); foreach (DataRow dr in dtWorkCard.Rows) { DataRow newRow = exportData.NewRow(); newRow["主叫号码"] = dr["CallerID"].ToString(); newRow["被叫号码"] = dr["CalledID"].ToString(); newRow["接听时间"] = dr["TimeStamp"].ToString(); newRow["呼叫类型"] = dr["Type"].ToString(); newRow["工作单类型"] = dr["WorkCardType"].ToString(); newRow["地址"] = dr["Address"].ToString(); newRow["座席员"] = dr["OperatorName"].ToString(); newRow["来电内容"] = dr["Memo"].ToString(); newRow["解决方案"] = dr["Process"].ToString(); exportData.Rows.Add(newRow); } WX.Utils.Office.ExportExcel(Page, exportData, this.Response, ""); ShowMessage("导出成功!"); } catch (Exception ex) { WX.EntLib_Base.ExceptionManager.WebExceptionManager.ProcessException(this, ex); ShowMessage("导出失败!"); } }
时间: 2024-11-06 10:35:57