Esempio n. 1
0
        void ExpoertExcel()
        {
            //Response.Write("<script>CallWriteExportStat('12');</script>");
            //Response.Write("<script>CallWriteExportStat(12,35)</script>");
            //Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"xx","alert('12');");
            // return;
            string condtion = GetCondtion();
            string sql      = @"select
            (select module_name from module_info where id = (select exami_module from exam_layout where id = b.layout_id)) as module_name,
            (select user_name from user_info where id =b.user_id ) as user_name,
            (select user_sex from user_info where id = b.user_id) as user_sex,
            b.user_card,
            (select work_name from work_info where id = b.work_id) as work_name,
            (select exami_name from exam_layout where id = b.layout_id ) as exami_name,
            b.score from exami_info b";
            //计算统计总数,总分页数
            DataTable Art_Table = DataCenter.Instans.SearchTb(string.Format("select count(id) as ct from exami_info b {0}", condtion));
            int       Datacount = int.Parse(Art_Table.Rows[0]["ct"].ToString());
            double    dx        = ((double)Datacount / EvPage);
            int       SumPage   = (int)Math.Ceiling(dx);//总页数
            //组合导出条件
            var item = new ExportContion()
            {
                sql = sql, condtion = condtion, DataCount = Datacount, SumPage = SumPage, EvePage = EvPage
            };

            DataToExcel.ExportExcelTemplate(item, ExcelPath, "公考成绩查询统计表", 3, 1, "", "", "");
        }