protected void btn_ExpToExcel_Click(object sender, EventArgs e) { //Excel.Application excel = new Excel.Application(); //wb = excel.Application.Workbooks.Add(true); //excel.Cells[1, 1] = "排 序"; //excel.Cells[1, 2] = "姓 名"; //excel.Cells[1, 3] = "性别"; //excel.Cells[1, 4] = "年龄"; //excel.Cells[1, 5] = "最高学历"; //excel.Cells[1, 6] = "符合申报条件学历"; //excel.Cells[1, 7] = "符合申报条件的毕业学校及时间"; //excel.Cells[1, 8] = "专业技术职务资格"; //excel.Cells[1, 9] = "资格评定时间"; //excel.Cells[1, 10] = "聘任专业技术职务"; //excel.Cells[1, 11] = "聘任时间"; //excel.Cells[1, 12] = "从事工作"; //excel.Cells[1, 13] = "学历资历审查情况"; //excel.Cells[1, 14] = "外语条件审查情况"; //excel.Cells[1, 15] = "计算机条件审查情况"; //excel.Cells[1, 16] = "上次申报年份"; //excel.Cells[1, 17] = "备注"; string str_sql = " select " + " name , " + //工作单位 " yourname, " + //姓名 " xingbie," + //性别 " Format(birth,'yyyy年mm月')," + //出生年月 " xkfx_qt," + //学科方向 " xrgw," + //现任岗位 " Format(prsj,'yyyy年mm月')," + //聘任时间 " ''" + //备注 " from ej_cpry ,t_dict where flm = 2 and url = dw and t_dict.ej_tj_flag = true and sh_flag='通过' and edit_flag = false and ej_cpry.tj_flag='推荐' order by dw asc, ID asc"; //DataView dv = DBFun.GetDataView(str_sql); //for (int i = 0; i < dv.Table.Rows.Count; i++) //{ // for (int j = 0; j < 15; j++) // { // excel.Cells[i + 2, j + 2] = dv.Table.Rows[i][j].ToString(); // } // excel.Cells[i + 2, 1] = Convert.ToString(i + 1); //} DataSet ds = DBFun.dataSet(str_sql); CreateExcel(ds, "1", "1.xls"); //excel.Visible = true; //excel.Save(); }
protected void btn_ExpToExcel_Click(object sender, EventArgs e) { //Excel.Application excel = new Excel.Application(); //wb = excel.Application.Workbooks.Add(true); //excel.Cells[1, 1] = "工作单位"; //excel.Cells[1, 2] = "姓 名"; //excel.Cells[1, 3] = "性别"; //excel.Cells[1, 4] = "出生年月"; //excel.Cells[1, 5] = "所学专业"; //excel.Cells[1, 6] = "技术职称"; //excel.Cells[1, 7] = "文化程度"; string str_sql = " SELECT gzdw_mc , " + //工作单位 " yourname, " + //姓名 " xingbie," + //性别 " Format(birth,'yyyy年mm月'), " + //出生年月 " sxzy," + //所学专业 " jszc," + //技术职称 " whcd," + //文化程度 " ''" + //备注 " FROM ts_cpry ,t_dict " + " WHERE flm = 2 " + " AND url = gzdw " + " AND t_dict.ts_tj_flag = true " + " AND sh_flag='通过' " + " AND edit_flag = false " + " AND ts_cpry.tj_flag='推荐' " + " ORDER BY gzdw asc, id asc"; //DataView dv = DBFun.GetDataView(str_sql); //for (int i = 0; i < dv.Table.Rows.Count; i++) //{ // for (int j = 0; j < 15; j++) // { // excel.Cells[i + 2, j + 2] = dv.Table.Rows[i][j].ToString(); // } // excel.Cells[i + 2, 1] = Convert.ToString(i + 1); //} DataSet ds = DBFun.dataSet(str_sql); CreateExcel(ds, "1", "1.xls"); //excel.Visible = true; //excel.Save(); }
protected void btn_ExpToExcel_Click(object sender, EventArgs e) { string strqry = "SELECT tjdw_mc,yourname,ejxk_mc ,lw_ctitle,zdjs_xm,cplb" + " FROM yxxwlw_cpry,t_dict" + " where url = tjdw and t_dict.tj_flag = true and edit_flag = false and yxxwlw_cpry.tj_flag = '推荐' "; if (RadioButtonList1.SelectedValue != "all") { strqry = strqry + " and sh_flag = '" + RadioButtonList1.SelectedValue + "'"; } strqry = strqry + " ORDER BY name asc , ID asc;"; DataSet ds = DBFun.dataSet(strqry); CreateExcel(ds, "1", "1.xls"); }
protected void Button1_Click(object sender, EventArgs e) { string str_TableName = ListBox1.SelectedValue; string str_Columns = ""; string str_sql; for (int i = 0; i < CheckBoxList1.Items.Count; i++) { if (CheckBoxList1.Items[i].Selected) { str_Columns += " , " + CheckBoxList1.Items[i].Value; } } str_sql = " select " + str_Columns.Remove(0, 2) + " from " + str_TableName; TextBox1.Text = str_sql; //ExcelManager.Exp2Excel(Page, str_sql); DataSet ds = DBFun.dataSet(str_sql); CreateExcel(ds, "1", "1.xls"); }
protected void btn_ExpToExcel_Click(object sender, EventArgs e) { //Excel.Application excel = new Excel.Application(); //wb = excel.Application.Workbooks.Add(true); //excel.Cells[1, 1] = "排 序"; //excel.Cells[1, 2] = "姓 名"; //excel.Cells[1, 3] = "性别"; //excel.Cells[1, 4] = "年龄"; //excel.Cells[1, 5] = "最高学历"; //excel.Cells[1, 6] = "符合申报条件学历"; //excel.Cells[1, 7] = "符合申报条件的毕业学校及时间"; //excel.Cells[1, 8] = "专业技术职务资格"; //excel.Cells[1, 9] = "资格评定时间"; //excel.Cells[1, 10] = "聘任专业技术职务"; //excel.Cells[1, 11] = "聘任时间"; //excel.Cells[1, 12] = "从事工作"; //excel.Cells[1, 13] = "学历资历审查情况"; //excel.Cells[1, 14] = "外语条件审查情况"; //excel.Cells[1, 15] = "计算机条件审查情况"; //excel.Cells[1, 16] = "上次申报年份"; //excel.Cells[1, 17] = "备注"; string str_sql = " select " + " name , " + //工作单位 " yourname, " + //姓名 " xingbie," + //性别 " iif( DateDiff('YYYY', CDate(iif(isnull(birth),now(),iif(birth='',now(),birth)) ), Format(Now(),'yyyy-mm-dd')" + " ) = 0,'', DateDiff('YYYY', CDate(iif(isnull(birth),now(),iif(birth='',now(),birth))),Format(Now(),'yyyy-mm-dd') " + " ) ) AS nianling, " + //年龄 " zgxl_mc," + //最高学历 " fhxl_mc," + //符合申报条件学历 " iif(isnull(fhxl_sydw),'',fhxl_sydw)+' '+iif(isnull(fhxl_bysj),'',fhxl_bysj) as xxsj ," + //符合申报条件的毕业学校及时间 " xrzw," + //专业技术职务资格 " Format(pdsj,'yyyy年mm月')," + //资格评定时间 //" sbzw, "+//聘任专业技术职务 " Format(prsj,'yyyy年mm月')," + //聘任时间 " sbzw, " + //申报专业技术职务 " csgz," + //从事工作 " iif (pglb='1','破格',iif(pglb = '2','破格','符合')) as xlzl," + //学历资历审查情况 " iif (wymsly='','符合',iif(isnull(wymsly),'符合','免试')) as wytj," + //外语条件审查情况 " iif (jsj_msly='','符合',iif(isnull(jsj_msly),'符合','免试')) as jsjtj," + //计算机条件审查情况 " iif (scsbnd='无','符合',iif(isnull(scsbnd),'符合',scsbnd)) as sbnd," + //上次申报年份 " '','',''" + " from cpry ,t_dict where flm = 2 and url = gzdw and t_dict.tj_flag = true and sh_flag='通过' and edit_flag = false and cpry.tj_flag='推荐' order by gzdw asc, ID asc"; //DataView dv = DBFun.GetDataView(str_sql); //for (int i = 0; i < dv.Table.Rows.Count; i++) //{ // for (int j = 0; j < 15; j++) // { // excel.Cells[i + 2, j + 2] = dv.Table.Rows[i][j].ToString(); // } // excel.Cells[i + 2, 1] = Convert.ToString(i + 1); //} DataSet ds = DBFun.dataSet(str_sql); CreateExcel(ds, "1", "1.xls"); //excel.Visible = true; //excel.Save(); }