日期:2014-05-17 浏览次数:20380 次
string filename = "预付保费网银" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_sssss") + ".xls"; XlsDocument xls = new XlsDocument(); xls.FileName = filename; Worksheet sheet = xls.Workbook.Worksheets.Add("Sheet1"); XF xfdate = xls.NewXF(); xfdate.Format = StandardFormats.Decimal_2; Cells cells = sheet.Cells; cells.Add(1, 1, "文件类型"); cells.Add(1, 2, "ExtPayBatch"); cells.Add(2, 1, "标题"); cells.Add(2, 2, "支付转账经办"); string[] titl = { "付款账号", "币种", "本/他行标志", "收款单位编号", "收款人账号", "收款人名称", "支付联行号", "开户网点名称", "开户地所在省/市/自治区", "开户地所在市/县", "支付方式", "支付金额", "预约支付标志", "预约支付日期", "预约支付时间", "摘要", "取票人证件种类", "取票人号码", "取票人姓名", "备注" }; for (int i = 0; i < titl.Length; i++) { cells.Add(4, i + 1, titl[i]); } string sql = "select fk_zh,sk_zh,sk_name,sk_hh,sk_kh,fee_pay from yfbf_fk where id in (" + ids + ")"; DataTable dt = DBUtility.DbHelperOra.Query(sql).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { cells.Add(i + 5, 1, dt.Rows[i]["fk_zh"]); cells.Add(i + 5, 2, "人民币"); cells.Add(i + 5, 3, "其他银行账户"); cells.Add(i + 5, 5, dt.Rows[i]["sk_zh"]); cells.Add(i + 5, 6, dt.Rows[i]["sk_name"]); cells.Add(i + 5, 7, dt.Rows[i]["sk_hh"]); cells.Add(i + 5, 8, dt.Rows[i]["sk_kh"]); cells.Add(i + 5, 11, "大额支付"); cells.Add(i + 5, 12, Convert.ToDecimal(dt.Rows[i]["fee_pay"]), xfdate); cells.Add(i + 5, 13, "立即支付"); cells.Add(i + 5, 16, "转款"); } string path = HttpContext.Current.Server.MapPath("~") + "\\YFBF\\excel"; xls.Save(path); return path + "\\" + filename;