protected void DownToExcel_B_Click(object sender, EventArgs e) { OfficeHelper office = new OfficeHelper(); string name = ZType.ToLower().Equals("comment") ? "评论排行.xls" : "点击排行.xls"; SafeC.DownStr(office.ExportExcel(GetDt(), "标题,点击数,评论数,录入者,录入时间"), DateTime.Now.ToString("yyyyMMdd") + "点击排行.xls", Encoding.Default); }
protected void Export_B_Click(object sender, EventArgs e) { OfficeHelper office = new OfficeHelper(); DataTable dt = contentBll.GroupDayCount(DataConverter.CLng(Request.Form["curNid_hid"]), Convert.ToInt32(Request.Form["years"]), Convert.ToInt32(Request.Form["months"]), Convert.ToInt32(Request.Form["model"])); dt.Columns.Add("Date"); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["Date"] = DataConverter.CDate(dt.Rows[i]["Years"] + "-" + dt.Rows[i]["Months"] + "-" + dt.Rows[i]["Days"]).ToString("yyyy-MM-dd");; } DataTable newDt = dt.DefaultView.ToTable(false, "Date,PCount,ComCount,Hits".Split(',')); SafeC.DownStr(office.ExportExcel(newDt, "日期,发稿量,评论数,点击数"), DateTime.Now.ToString("yyyyMMdd") + "时间统计.xls", Encoding.Default); }
protected void DownExcel_Btn_Click(object sender, EventArgs e) { M_Pub_Excel excelMod = new M_Pub_Excel(); B_Pub_Excel excelBll = new B_Pub_Excel(); M_Pub pubinfo = pub.GetSelect(PubID); excelMod = excelBll.SelByTbName(pubinfo.PubTableName); if (excelMod == null) { function.WriteErrMsg("尚未为表:" + pubinfo.PubTableName + "指定导出规则,请先<a href='PubExcel.aspx?mid=" + pubinfo.PubModelID + "'>点此设定导出规则</a>"); } OfficeHelper ofHelper = new OfficeHelper(); SafeC.DownStr(ofHelper.GetExcelByDT(GetDT(), excelMod.Fields, excelMod.CNames), DateTime.Now.ToString("yyyyMMdd") + "互动信息.xls", Encoding.Default); }
protected void ExportExcel_B_Click(object sender, EventArgs e) { OfficeHelper helper = new OfficeHelper(); DataTable dt = orderBll.IDC_Sel((int)M_OrderList.OrderEnum.IDC, souchtable.SelectedValue, souchkey.Text, OrderBy, SelType); dt.Columns.Add("UserName"); dt.Columns.Add("IsExpire"); //是否过期 dt.Columns.Add("OStatus"); //状态 dt.Columns.Add("PStatus"); //财务 for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; dr["UserName"] = GetUsers(dr["UserID"].ToString()); dr["Domain"] = dr["Domain"].ToString().ToLower().Replace("www.", ""); dr["STime"] = DataConvert.CDate(dr["STime"]).ToString("yyyy-MM-dd"); dr["ETime"] = DataConvert.CDate(dr["ETime"]).ToString("yyyy-MM-dd"); dr["OStatus"] = RemoveHtml(formatzt(dr["OrderStatus"].ToString(), "0")); dr["PStatus"] = RemoveHtml(formatzt(dr["Paymentstatus"].ToString(), "1")); } DataTable newDt = dt.DefaultView.ToTable(false, "ID,OrderNo,Domain,UserName,Proname,STime,ETime,IsExpire,OStatus,PStatus".Split(',')); string columnames = "ID,订单号,绑定域名,会员,商品名称,生效时间,到期时间,是否到期,状态,财务"; SafeC.DownStr(helper.ExportExcel(newDt, columnames), DateTime.Now.ToString("yyyyMMdd") + "IDC订单表.xls", Encoding.UTF8); }
protected void Export_Click(object sender, EventArgs e) { OfficeHelper office = new OfficeHelper(); SafeC.DownStr(office.ExportExcel(SelDT(), "编辑,发稿量,评论量,点击数"), DateTime.Now.ToString("yyyyMMdd") + "编辑统计.xls", Encoding.Default); }
public static void DownStr(string str, string fname) { SafeC.DownStr(str, fname); }