/** * 导出到Excel */ public void Ecport_excel(object sender, RoutedEventArgs e) { EX ex = new EX(); //(System.Data.DataTable dt,string dir,string title,string subject,string category,string company,string author) System.Data.DataTable table = dt.Copy(); table.Columns.Remove("_id"); table.Columns.Remove("PHOTO"); table.Columns["NAME"].ColumnName = "姓名"; table.Columns["TEACHERNUMBER"].ColumnName = "用户编号"; table.Columns["AGE"].ColumnName = "年龄"; table.Columns["SEX"].ColumnName = "性别"; table.Columns["PHONE"].ColumnName = "电话"; table.Columns["EMAIL"].ColumnName = "电子邮箱"; table.Columns["POSITION"].ColumnName = "地址"; table.Columns["DIRECTION"].ColumnName = "方向"; table.Columns["DETAILS"].ColumnName = "简介"; table.Columns["REMARK"].ColumnName = "备注"; string path = ex.dataTableToExcel(table, "师资信息汇总表", "师资", "师资信息", "国家电网", "软件自动生成"); if (path != null && !path.Trim().Equals("")) { Message msg = new Message("数据导出", "指定的已数据成功导出为Excel文档。路径为:" + path); msg.ShowDialog(); } }
/** * 导出到Excel */ public void Ecport_excel(object sender, RoutedEventArgs e) { EX ex = new EX(); //(System.Data.DataTable dt,string dir,string title,string subject,string category,string company,string author) // System.Data.DataTable table = dt.Copy(); System.Data.DataTable table = this.getSelected(); table.Columns.Remove("_id"); table.Columns.Remove("ADDTIME"); table.Columns["GMT_time"].ColumnName = "订单添加时间"; string path = ex.dataTableToExcel(table, "订单信息汇总表", "订单", "订单信息", "电网", "软件自动生成"); if (path != null && !path.Trim().Equals("")) { Message msg = new Message("数据导出", "指定的已数据成功导出为Excel文档。路径为:" + path); msg.ShowDialog(); } }
/** * 导出到Excel */ public void Ecport_excel(object sender, RoutedEventArgs e) { EX ex = new EX(); //(System.Data.DataTable dt,string dir,string title,string subject,string category,string company,string author) System.Data.DataTable table = dt.Copy(); table.Columns.Remove("_id"); table.Columns.Remove("PHOTO"); table.Columns["COURSENUMBER"].ColumnName = "课程编号"; table.Columns["NAME"].ColumnName = "课程名"; table.Columns["CATEGORY"].ColumnName = "类别"; table.Columns["TEACHER"].ColumnName = "讲师"; table.Columns["TIME"].ColumnName = "课时"; table.Columns["PRICE"].ColumnName = "价格"; table.Columns["DETAILS"].ColumnName = "简介"; table.Columns["REMARK"].ColumnName = "备注"; string path = ex.dataTableToExcel(table, "课程信息汇总表", "课程", "课程信息", "电网", "软件自动生成"); if (path != null && !path.Trim().Equals("")) { Message msg = new Message("数据导出", "指定的已数据成功导出为Excel文档。路径为:" + path); msg.ShowDialog(); } }
/** * 导出到Excel */ public void Ecport_excel(object sender, RoutedEventArgs e) { EX ex = new EX(); //(System.Data.DataTable dt,string dir,string title,string subject,string category,string company,string author) System.Data.DataTable table = dt.Copy(); table.Columns.Add("是否管理员"); for (int i = 0; i < table.Rows.Count; i++) { table.Rows[i]["是否管理员"] = table.Rows[i]["IS_ADMIN"].ToString().Equals("1") ? "是" : "否"; } table.Columns.Remove("IS_ADMIN"); table.Columns.Remove("_id"); table.Columns.Remove("PASSWORD"); table.Columns["NAME"].ColumnName = "联系人"; table.Columns.Remove("PHOTO"); table.Columns["USERNAME"].ColumnName = "客户名"; table.Columns["AGE"].ColumnName = "年龄"; table.Columns["SEX"].ColumnName = "性别"; table.Columns["PHONE"].ColumnName = "联系人电话"; table.Columns["EMAIL"].ColumnName = "电子邮箱"; table.Columns["ADDRESS"].ColumnName = "地址"; table.Columns["REMARK"].ColumnName = "备注"; string path = ex.dataTableToExcel(table, "客户信息汇总表", "用户", "用户信息", "电网", "软件自动生成"); if (path != null && !path.Trim().Equals("")) { Message msg = new Message("数据导出", "指定的已数据成功导出为Excel文档。路径为:" + path); msg.ShowDialog(); } }