当前位置: 首页>>代码示例>>C#>>正文


C# ExcelAccess.CopySheet方法代码示例

本文整理汇总了C#中ExcelAccess.CopySheet方法的典型用法代码示例。如果您正苦于以下问题:C# ExcelAccess.CopySheet方法的具体用法?C# ExcelAccess.CopySheet怎么用?C# ExcelAccess.CopySheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExcelAccess的用法示例。


在下文中一共展示了ExcelAccess.CopySheet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExportExcel

        public static void ExportExcel(Dictionary<string, List<PJ_qxfl>> objdic)
        {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\06设备巡视及缺陷消除记录.xls";

            ex.Open(fname);
            int zc = 20;
            //与会人员之间的间隔符号
            char[] jksign = new char[1] { ';' };
            int row = 7;
            int col = 1;
            int len1 = 3;
            int pageindex = 1;
            pageindex = objdic.Count;
            //根据所有的线路数来确定创建的页数
            for (int j = 1; j <= pageindex; j++)
            {
                if (j > 1)
                {
                    ex.CopySheet(1, 1);
                }
            }
            int pags = 0;
            foreach (KeyValuePair<string, List<PJ_qxfl>> pp in objdic)
            {
                List<PJ_qxfl> objlist = pp.Value;
                ex.ActiveSheet(pags++);

            }

        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:32,代码来源:ExportQX.cs

示例2: ExportExcel10KV

        public static void ExportExcel10KV(IList<PS_kgjctj> datalist)
        {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\10KV用户供电可靠性基础数据统计表.xls";
            ex.Open(fname);

            int rowcount = 1;
            if (datalist.Count < 1) return;
            string tablename = "10KV用户供电可靠性基础数据统计表";
            if (tablename.Length > 30)
            {
                tablename = tablename.Substring(tablename.Length - 31);
            }
            //
            //加页
            int pageindex = datalist.Count;

            for (int j = 1; j < pageindex; j++)
            {
                ex.CopySheet(1, j);
                ex.ReNameWorkSheet(j + 1, tablename + "(" + (j) + ")");
            }
            for (int j = 0; j < datalist.Count; j++)
            {
                if (j == 0)
                {
                    ex.ActiveSheet(tablename);
                }
                else
                {
                    ex.ActiveSheet(tablename + "(" + j + ")");
                }
                // 填值
                ex.SetCellValue(datalist[j].OrgName, 3, 2);
                ex.SetCellValue(datalist[j].CreateTime.ToString("yyyy年MM月dd日"), 5, 9);
                ex.SetCellValue(datalist[j].kgModel, 5, 2);
                ex.SetCellValue(datalist[j].iscxkg == true ? "是" : "否", 5, 7);
                ex.SetCellValue(datalist[j].kgCode, 5, 9);
                ex.SetCellValue(datalist[j].jkdxcd, 10, 2);
                ex.SetCellValue(datalist[j].dlxlcd, 10, 7);
                ex.SetCellValue(datalist[j].publicusercount.ToString(), 11, 2);
                ex.SetCellValue(datalist[j].publicbtcount.ToString(), 11, 5);
                ex.SetCellValue(datalist[j].publicbtrlcount.ToString(), 11, 9);
                ex.SetCellValue(datalist[j].zyusercount.ToString(), 12, 2);
                ex.SetCellValue(datalist[j].zybtcount.ToString(), 12, 5);
                ex.SetCellValue(datalist[j].zybtrlcount.ToString(), 12, 9);

                ex.SetCellValue(datalist[j].sdyusercount.ToString(), 13, 2);
                ex.SetCellValue(datalist[j].sdyrlcount.ToString(), 13, 5);
                ex.SetCellValue(datalist[j].zyuserqtsbcount.ToString(), 13, 9);

                ex.SetCellValue(datalist[j].drqcount.ToString(), 14, 2);
                ex.SetCellValue(datalist[j].drqrl, 14, 5);
                ex.SetCellValue(datalist[j].zyuserqtsbrlcount.ToString(), 14, 9);
            }
            ex.ActiveSheet(tablename);
            ex.ShowExcel();
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:59,代码来源:Export12.cs

示例3: CreatandWritesheet1

        /// <summary>
        ///创建工作表并将数据加入到工作表中
        /// </summary>
        /// <param name="ex">操作EXCEL表</param>
        /// <param name="bdzlist">填入的数据</param>
        ///  <param name="hs">一页对应的总行数</param>
        ///  <param name="stawz">一页中填入的开始的位置</param>
        ///  <param name="pageindex">一页填入的列位置</param>
        ///  <param name="strnumcol">第一个字符开始的行数</param>
        ///  <param name="boldnum">加粗的数量</param>
        public static void CreatandWritesheet1(ExcelAccess ex, List<string> bdzlist, int hs, int star, int clm,int[] strnumcol,int[] boldnum)
        {
            int pageindex = 1;
            if (pageindex < Ecommonjh.GetPagecount(bdzlist.Count, hs))
            {
                pageindex = Ecommonjh.GetPagecount(bdzlist.Count, hs);
            }
            for (int j = 1; j <= pageindex; j++)
            {
                if (j > 1)
                {
                    ex.CopySheet(1, 1);

                }
            }
            ex.ShowExcel();
            for (int j = 1; j <= pageindex; j++)
            {

                ex.ActiveSheet(j);
                ex.ReNameWorkSheet(j, "Sheet" + (j));
                int prepageindex = j - 1;
                //主题
                int starow = prepageindex * hs + 1;
                int endrow = j * hs;
                if (bdzlist.Count > endrow)
                {
                    for (int i = 0; i < hs; i++)
                    {

                        ex.SetCellValue(bdzlist[starow - 1 + i], star + i, clm);
                        //加粗过程
                        for (int n = 0; n < strnumcol.Length;n++ )
                        {
                            if (starow-1+i==strnumcol[n])
                            {
                                ex.SetFontBold(star + i, clm, star + i, clm, true, 0, boldnum[n]);
                            }
                          
                        }

                        //ex.SetCellValue(objlist[starow - 1 + i].rq.Month.ToString(), rowcount + i, 1);
                        //ex.SetCellValue(objlist[starow - 1 + i].rq.Day.ToString(), rowcount + i, 2);
                        //ex.SetCellValue(objlist[starow - 1 + i].rq.Hour.ToString(), rowcount + i, 3);
                        //ex.SetCellValue(objlist[starow - 1 + i].rq.Minute.ToString(), rowcount + i, 4);
                        //ex.SetCellValue(objlist[starow - 1 + i].lxfs, rowcount + i, 5);
                        //ex.SetCellValue(objlist[starow - 1 + i].yhdz, rowcount + i, 6);
                        //ex.SetCellValue(objlist[starow - 1 + i].gzjk, rowcount + i, 7);
                        //ex.SetCellValue(objlist[starow - 1 + i].djr, rowcount + i, 8);
                        //ex.SetCellValue(objlist[starow - 1 + i].clr, rowcount + i, 9);

                    }
                }
                else if (bdzlist.Count <= endrow && bdzlist.Count >= starow)
                {
                    for (int i = 0; i < bdzlist.Count - starow + 1; i++)
                    {
                        ex.SetCellValue(bdzlist[starow - 1 + i], star + i, clm);
                        //加粗过程
                        for (int n = 0; n < strnumcol.Length; n++)
                        {
                            if (starow - 1 + i == strnumcol[n])
                            {
                                ex.SetFontBold(star + i, clm, star + i, clm, true, 0, boldnum[n]);
                            }

                        }

                        //ex.SetCellValue(objlist[starow - 1 + i].rq.Month.ToString(), rowcount + i, 1);
                        //ex.SetCellValue(objlist[starow - 1 + i].rq.Day.ToString(), rowcount + i, 2);
                        //ex.SetCellValue(objlist[starow - 1 + i].rq.Hour.ToString(), rowcount + i, 3);
                        //ex.SetCellValue(objlist[starow - 1 + i].rq.Minute.ToString(), rowcount + i, 4);
                        //ex.SetCellValue(objlist[starow - 1 + i].lxfs, rowcount + i, 5);
                        //ex.SetCellValue(objlist[starow - 1 + i].yhdz, rowcount + i, 6);
                        //ex.SetCellValue(objlist[starow - 1 + i].gzjk, rowcount + i, 7);
                        //ex.SetCellValue(objlist[starow - 1 + i].djr, rowcount + i, 8);
                        //ex.SetCellValue(objlist[starow - 1 + i].clr, rowcount + i, 9);

                    }
                }
            }
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:92,代码来源:Ecommonjh.cs

示例4: ExportExcel

        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public static void ExportExcel(IList<PJ_21gzbxdh> objlist)
        {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\21电力故障电话接听记录.xls";

            ex.Open(fname);
            //此处写填充内容代码
            int rowcount = 7;
            //加页
            int pageindex = 1;
            if (pageindex < Ecommon.GetPagecount(objlist.Count, 19))
            {
                pageindex = Ecommon.GetPagecount(objlist.Count, 19);
            }
            for (int j = 1; j <= pageindex; j++)
            {
                if (j > 1)
                {
                    ex.CopySheet(1, 1);
                }
            }
            ex.ShowExcel();
            for (int j = 1; j <= pageindex; j++)
            {

                ex.ActiveSheet(j);
                ex.ReNameWorkSheet(j, "Sheet" + (j));
                int prepageindex = j - 1;
                //主题
                int starow = prepageindex * 19 + 1;
                int endrow = j * 19;
                if (objlist.Count > endrow)
                {
                    for (int i = 0; i < 19; i++)
                    {


                        ex.SetCellValue(objlist[starow - 1 + i].rq.Month.ToString(), rowcount + i, 1);
                        ex.SetCellValue(objlist[starow - 1 + i].rq.Day.ToString(), rowcount + i, 2);
                        ex.SetCellValue(objlist[starow - 1 + i].rq.Hour.ToString(), rowcount + i, 3);
                        ex.SetCellValue(objlist[starow - 1 + i].rq.Minute.ToString(), rowcount + i, 4);
                        ex.SetCellValue(objlist[starow - 1 + i].lxfs, rowcount + i, 5);
                        ex.SetCellValue(objlist[starow - 1 + i].yhdz, rowcount + i, 6);
                        ex.SetCellValue(objlist[starow - 1 + i].gzjk, rowcount + i, 9);
        //                ex.SetCellValue(objlist[starow - 1 + i].djr, rowcount + i,12);
        //                ex.SetCellValue(objlist[starow - 1 + i].clr, rowcount + i, 13);

                    }
                }
                else if (objlist.Count <= endrow && objlist.Count >= starow)
                {
                    for (int i = 0; i < objlist.Count - starow + 1; i++)
                    {
                        ex.SetCellValue(objlist[starow - 1 + i].rq.Month.ToString(), rowcount + i, 1);
                        ex.SetCellValue(objlist[starow - 1 + i].rq.Day.ToString(), rowcount + i, 2);
                        ex.SetCellValue(objlist[starow - 1 + i].rq.Hour.ToString(), rowcount + i, 3);
                        ex.SetCellValue(objlist[starow - 1 + i].rq.Minute.ToString(), rowcount + i, 4);
                        ex.SetCellValue(objlist[starow - 1 + i].lxfs, rowcount + i, 5);
                        ex.SetCellValue(objlist[starow - 1 + i].yhdz, rowcount + i, 6);
                        ex.SetCellValue(objlist[starow - 1 + i].gzjk, rowcount + i, 9);
          //              ex.SetCellValue(objlist[starow - 1 + i].djr, rowcount + i, 12);
          //              ex.SetCellValue(objlist[starow - 1 + i].clr, rowcount + i, 13);

                    }
                }
            }
            ex.ActiveSheet(1);
             string orgname="";
            if (objlist.Count>0)
            {
                orgname = objlist[0].OrgName;
            }
         
            //变电所内容
            ex.SetCellValue(orgname, 4, 5);
           
            //记录
            //for (int i = 0; i < objlist.Count;i++ )
            //{
            //    ex.SetCellValue(objlist[i].rq.Month.ToString(), rowcount + i, 1);
            //    ex.SetCellValue(objlist[i].rq.Day.ToString(), rowcount + i, 2);
            //    ex.SetCellValue(objlist[i].rq.Hour.ToString(), rowcount + i, 3);
            //    ex.SetCellValue(objlist[i].rq.Minute.ToString(), rowcount + i, 4);
            //    ex.SetCellValue(objlist[i].lxfs, rowcount + i, 5);
            //    ex.SetCellValue(objlist[i].yhdz, rowcount + i, 6);
            //    ex.SetCellValue(objlist[i].gzjk, rowcount + i, 7);
            //    ex.SetCellValue(objlist[i].djr, rowcount + i,8);
            //    ex.SetCellValue(objlist[i].clr, rowcount + i,9);
            //}
            ex.ShowExcel();
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:96,代码来源:Export21.cs

示例5: ExportExcel

 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public static void ExportExcel(IList<sdjl_07jdzz> objlist) {
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\送电08接地装置检测.xls";
     ex.Open(fname);
     //此处写填充内容代码
     int rowcount = 6;
     //加页
     int pageindex = 1;
     if (pageindex < Ecommon.GetPagecount(objlist.Count, 16))
     {
         pageindex = Ecommon.GetPagecount(objlist.Count, 16);
     }
     for (int j = 1; j <= pageindex; j++)
     {
         ex.SetCellValue(objlist[0].LineName, 4, 3);
         if (j > 1)
         {
             ex.CopySheet(1, 1);
         }
     }
     for (int j = 1; j <= pageindex; j++)
     {
         ex.ActiveSheet(j);
         ex.ReNameWorkSheet(j, "Sheet" + (j));
         int prepageindex = j - 1;
         //主题
         int starow = prepageindex * 16 + 1;
         int endrow = j * 16;
         if (objlist.Count > endrow)
         {
             for (int i = 0; i < 16; i++)
             {
                 ex.SetCellValue(objlist[starow - 1 + i].gth, rowcount + 1 + i, 1);
                 ex.SetCellValue(objlist[starow - 1 + i].gzwz, rowcount + 1 + i, 2);
                 ex.SetCellValue(objlist[starow - 1 + i].sbmc, rowcount + 1 + i, 3);
                 ex.SetCellValue(objlist[starow - 1 + i].jddz.ToString(), rowcount + 1 + i, 4);
                 ex.SetCellValue(objlist[starow - 1 + i].CreateDate.Year.ToString(), rowcount + 1 + i, 5);
                 ex.SetCellValue(objlist[starow - 1 + i].CreateDate.Month.ToString(), rowcount + 1 + i, 6);
                 ex.SetCellValue(objlist[starow - 1 + i].CreateDate.Day.ToString(), rowcount + 1 + i, 7);
                 ex.SetCellValue(objlist[starow - 1 + i].trdzr.ToString(), rowcount + 1 + i, 8);
                 ex.SetCellValue(objlist[starow - 1 + i].tz.ToString(), rowcount + 1 + i, 9);
                 ex.SetCellValue(objlist[starow - 1 + i].xhgg, rowcount + 1 + i, 10);
                 ex.SetCellValue(objlist[starow - 1 + i].fzxl, rowcount + 1 + i, 11);
                 ex.SetCellValue(objlist[starow - 1 + i].CreateMan, rowcount + 1 + i, 12);
             }
         }
         else if (objlist.Count <= endrow && objlist.Count >= starow)
         {
             for (int i = 0; i < objlist.Count - starow + 1; i++)
             {
                 ex.SetCellValue(objlist[starow - 1 + i].gth, rowcount + 1 + i, 1);
                 ex.SetCellValue(objlist[starow - 1 + i].gzwz, rowcount + 1 + i, 2);
                 ex.SetCellValue(objlist[starow - 1 + i].sbmc, rowcount + 1 + i, 3);
                 ex.SetCellValue(objlist[starow - 1 + i].jddz.ToString(), rowcount + 1 + i, 4);
                 ex.SetCellValue(objlist[starow - 1 + i].CreateDate.Year.ToString(), rowcount + 1 + i, 5);
                 ex.SetCellValue(objlist[starow - 1 + i].CreateDate.Month.ToString(), rowcount + 1 + i, 6);
                 ex.SetCellValue(objlist[starow - 1 + i].CreateDate.Day.ToString(), rowcount + 1 + i, 7);
                 ex.SetCellValue(objlist[starow - 1 + i].trdzr.ToString(), rowcount + 1 + i, 8);
                 ex.SetCellValue(objlist[starow - 1 + i].tz.ToString(), rowcount + 1 + i, 9);
                 ex.SetCellValue(objlist[starow - 1 + i].xhgg, rowcount + 1 + i, 10);
                 ex.SetCellValue(objlist[starow - 1 + i].fzxl, rowcount + 1 + i, 11);
                 ex.SetCellValue(objlist[starow - 1 + i].CreateMan, rowcount + 1 + i, 12);
                 //ex.SetCellValue(objlist[starow - 1 + i].Remark, rowcount + i, 10);
             }
         }
     }
    ex.ActiveSheet(1);
    ex.ShowExcel();
 }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:74,代码来源:ExportSD08.cs

示例6: ExportExcel

        public void ExportExcel(ExcelAccess ex, IList<PJ_sbbzqsbgmxb3> datalist, string orgid)
        {
            //此处写填充内容代码
            int row = 6;
            int col = 1;
            int rowcount = 15;

            //

            //加页
            int pageindex = 1;
            if (pageindex < Ecommon.GetPagecount(datalist.Count, rowcount))
            {
                pageindex = Ecommon.GetPagecount(datalist.Count, rowcount);
            }
            for (int j = 1; j <pageindex; j++)
            {

                ex.CopySheet(1, j);
               
            }
            for (int j = 0; j < datalist.Count; j++)
            {

                if (j % rowcount == 0)
                {
                    if(j==0)ex.ActiveSheet(1);
                    else ex.ActiveSheet((j / rowcount+1) );
                    if (orgid!="") ex.SetCellValue(datalist[j].OrgName, 4, 2);
                    else
                        ex.SetCellValue(MainHelper.UserCompany, 4, 2);
                    ex.SetCellValue(DateTime.Now.ToString("yyyy年MM月dd日"), 4,5);

                }
                ex.SetCellValue((j + 1).ToString(), row + j % rowcount, col);
                ex.SetCellValue(datalist[j].sssbmc, row + j % rowcount, col + 1);
                ex.SetCellValue(datalist[j].sssswz, row + j % rowcount, col + 2);

                ex.SetCellValue(datalist[j].sssbbh, row + j % rowcount, col + 3);
                ex.SetCellValue(datalist[j].statuts, row + j % rowcount, col + 4);
                ex.SetCellValue(datalist[j].Remark, row + j % rowcount, col + 5);
                //ex.SetCellValue(datalist[j].zrr, row + j % rowcount, col + 7);


            }
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:46,代码来源:ExportSBBZQSBGMXB3Edit.cs

示例7: ExportExcel

        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public static void ExportExcel(PS_tqdlbh jl) {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\13剩余电流动作保护器测试记录.xls";

            ex.Open(fname);
            int row = 1;
            int col = 1;
            //测量记录
            IList<PJ_13dlbhjl> list = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_13dlbhjl>(" where sbID='" + jl.sbID + "' order by CreateDate");
            int p = Ecommon.GetPagecount(list.Count, 12);

            for (int i = 0; i < p - 1; i++) {
                ex.CopySheet(1, 1 + i);
            }
            ex.ActiveSheet(1);

            //线路名称行
            ex.SetCellValue(jl.tqName, 4, 1);
            ex.SetCellValue(jl.Factory, 5, 13);
            ex.SetCellValue(jl.InstallAdress, row + 4, col + 3);
            ex.SetCellValue(jl.dzdl, row + 4, col + 6);
            ex.SetCellValue(jl.sbModle, row + 4, col + 10);
            ex.SetCellValue(jl.Factory, row + 4, col + 13);
            //设备名称行
            ex.SetCellValue(jl.glr, row + 6, col + 3);
            ex.SetCellValue(jl.dzsj, row + 6, col + 6);
            ex.SetCellValue(jl.InDate.Year.ToString(), row + 7, col + 10);
            ex.SetCellValue(jl.InDate.Month.ToString(), row + 7, col + 11);
            ex.SetCellValue(jl.InDate.Day.ToString(), row + 7, col + 13);

            for (int page = 1; page <= p; page++) {
                ex.ActiveSheet(page);
                if (page == 1) {

                    for (int i = 0; i < 12; i++) {

                        if (i + (page - 1) * 12 < list.Count) {
                            PJ_13dlbhjl obj = list[i + (page - 1) * 12];
                            ex.SetCellValue(obj.rq.Year.ToString(), row + 11 + i, col);
                            ex.SetCellValue(obj.rq.Month.ToString(), row + 11 + i, col + 1);
                            ex.SetCellValue(obj.rq.Day.ToString(), row + 11 + i, col + 2);
                            ex.SetCellValue(obj.dzdl, row + 11 + i, col + 3);
                            ex.SetCellValue(obj.dzsj.ToString(), row + 11 + i, col + 4);
                            ex.SetCellValue(obj.yxqk, row + 11 + i, col + 5);
                            ex.SetCellValue(obj.csr, row + 11 + i, col + 6);
                        }
                    }
                } else {
                    for (int i = 0; i < 12; i++) {

                        if (i + (page - 1) * 12 < list.Count) {
                            PJ_13dlbhjl obj = list[i + (page - 1) * 12];
                            ex.SetCellValue(obj.rq.Year.ToString(), row + 11 + i, col);
                            ex.SetCellValue(obj.rq.Month.ToString(), row + 11 + i, col + 1);
                            ex.SetCellValue(obj.rq.Day.ToString(), row + 11 + i, col + 2);
                            ex.SetCellValue(obj.dzdl, row + 11 + i, col + 3);
                            ex.SetCellValue(obj.dzsj.ToString(), row + 11 + i, col + 4);
                            ex.SetCellValue(obj.yxqk, row + 11 + i, col + 5);
                            ex.SetCellValue(obj.csr, row + 11 + i, col + 6);
                        }
                    }
                }
            }
            ex.ActiveSheet(1);
            ex.ShowExcel();
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:71,代码来源:Export13.cs

示例8: ExportExcel

        public void ExportExcel(ExcelAccess ex ,IList<PJ_anqgjcrkd> datalist)
        {
            
            //此处写填充内容代码
            int row = 4;
            int col = 1;
            int rowcount = 23;

            //

            //加页
            int pageindex = 1;
            if (pageindex < Ecommon.GetPagecount(datalist.Count, rowcount))
            {
                pageindex = Ecommon.GetPagecount(datalist.Count, rowcount);
            }
            for (int j = 1; j <= pageindex; j++)
            {

                ex.CopySheet(1, j);
                if (j == 1) ex.ReNameWorkSheet(j + 1,  datalist[0].num);
                else
                    ex.ReNameWorkSheet(j + 1, datalist[0].num + "(" + (j) + ")");
            }
            for (int j = 0; j < datalist.Count; j++)
            {

                if (j % rowcount == 0)
                {
                    if (j == 0) ex.ActiveSheet(datalist[0].num);
                    else ex.ActiveSheet( datalist[0].num + "(" + (j / rowcount + 1) + ")");
                    ex.SetCellValue(datalist[j].OrgName, 2, 2);

                    
                }

                ex.SetCellValue((j + 1).ToString(), row + j % rowcount, col);
                ex.SetCellValue(datalist[j].wpmc, row + j % rowcount, col + 1);
                ex.SetCellValue(datalist[j].wpdw, row + j % rowcount, col + 2);
                ex.SetCellValue(datalist[j].wpgg, row + j % rowcount, col + 3);

                ex.SetCellValue(datalist[j].cksl, row + j % rowcount, col + 4);
                ex.SetCellValue(datalist[j].lqdw, row + j % rowcount, col + 5);
                ex.SetCellValue(datalist[j].Remark, row + j % rowcount, col + 6);
                //ex.SetCellValue(datalist[j].zrr, row + j % rowcount, col + 7);


            }
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:49,代码来源:ExportAQGJSCKEdit.cs

示例9: ExportExcel

        public void ExportExcel(ExcelAccess ex, IList<PJ_qcxqjh> datalist)
        {
            //此处写填充内容代码
            int row = 5;
            int col = 1;
            int rowcount = 6;

            //

            //加页
            int pageindex = 1;
            if (pageindex < Ecommon.GetPagecount(datalist.Count, rowcount))
            {
                pageindex = Ecommon.GetPagecount(datalist.Count, rowcount);
            }
            for (int j = 1; j < pageindex; j++)
            {

                ex.CopySheet(1, j);
              
            }
            for (int j = 0; j < datalist.Count; j++)
            {

                if (j % rowcount == 0)
                {
                    if (j == 0) ex.ActiveSheet(1);
                    else ex.ActiveSheet( (j / rowcount + 1));

                    ex.SetCellValue(DateTime.Now.ToString("yyyy年") + "春查线路设备消缺计划表", 2, 1);

                    

                }
                ex.SetCellValue((j + 1).ToString(), row + j % rowcount, col);
                ex.SetCellValue(datalist[j].xqlr, row + j % rowcount, col + 1);
                ex.SetCellValue(datalist[j].xqbz, row + j % rowcount, col + 2);
                ex.SetCellValue(datalist[j].wcsj.ToString("MM月dd日"), row + j % rowcount, col + 3);
                ex.SetCellValue(datalist[j].lsr, row + j % rowcount, col + 4);

                


            }
        
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:46,代码来源:ExportGDSQCXQJH.cs

示例10: ExportExcel

        public void ExportExcel(ExcelAccess ex ,IList<PJ_jggcjh> datalist)
        {
            //此处写填充内容代码
            int row = 7;
            int col = 1;
            int rowcount = 9;

            //

            //加页
            int pageindex = 1;
            if (pageindex < Ecommon.GetPagecount(datalist.Count, rowcount))
            {
                pageindex = Ecommon.GetPagecount(datalist.Count, rowcount);
            }
            for (int j = 1; j <= pageindex; j++)
            {
                if (j > 1)
                {
                    ex.CopySheet(1, 1);
                }
            }
            int year = DateTime.Now.Year;
            string str = "零一二三四五六七八九";
            string stryear = "";
            while (year > 0)
            {
                
                stryear = str[year % 10]+stryear;
                year = year / 10;
            }
            for (int j = 0; j < datalist.Count; j++)
            {

                if (j % rowcount == 0)
                {
                    ex.ActiveSheet(j / rowcount + 1);
                    ex.SetCellValue(datalist[j].OrgName,4, 3);
                    //年技术改造工程计划
                    ex.SetCellValue(stryear + "年技术改造工程计划", 2, 1);
                }
                ex.SetCellValue((j + 1).ToString(), row + j % rowcount, col);
                ex.SetCellValue(datalist[j].ProjectName, row + j % rowcount, col + 1);
                ex.SetCellValue(datalist[j].ProjecNR, row + j % rowcount, col + 5);
                ex.SetCellValue(datalist[j].Planenddate.ToString("yyyy年MM月"), row + j % rowcount, col + 9);

                ex.SetCellValue(datalist[j].NeedFunds, row + j % rowcount, col + 10);
                ex.SetCellValue(datalist[j].Remark, row + j % rowcount, col + 11);

            }
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:51,代码来源:ExportJGGCJH.cs

示例11: ExportExcel

        //ExcelAccess
        public static void ExportExcel(PJ_05jcky jl) {

            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\05交叉跨越及对地距离测量记录.xls";
            ex.Open(fname);
            int row = 1;
            int col = 1;
            int rowcount = 11;
            //
            IList<PJ_05jckyjl> list = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_05jckyjl>(" where jckyID='" + jl.jckyID + "' order by CreateDate");
            //加页
            int pageindex = 1;
            if (pageindex < Ecommon.GetPagecount(list.Count, 15)) {
                pageindex = Ecommon.GetPagecount(list.Count, 15);
            }
            for (int j = 1; j <= pageindex; j++) {
                if (j > 1) {
                    ex.CopySheet(1, 1);
                }
            }
            // PS_xl xlobject = Client.ClientHelper.PlatformSqlMap.GetOneByKey<PS_xl>(jl.LineID);
            ex.ActiveSheet(1);
            PS_xl xl = Client.ClientHelper.PlatformSqlMap.GetOne<PS_xl>(" where linecode='" + jl.LineID + "'");
            if (xl != null) {
                string sublinename = "";
                string linename = andparentlinename(xl);
                string[] fz = linename.Split(" ".ToCharArray());
                if (fz.Length > 2) {
                    sublinename += fz[0] + " " + fz[1] + " " + fz[fz.Length - 1];
                } else
                    sublinename = linename;
                ex.SetCellValue(linename, row + 3, col + 1);
            } else {
                string sublinename = "";
                string linename = jl.kywz;
                string[] fz = linename.Split(" ".ToCharArray());
                if (fz.Length > 2) {
                    sublinename += fz[0] + " " + fz[1] + " " + fz[fz.Length - 1];
                } else
                    sublinename = linename;
                ex.SetCellValue(linename, row + 3, col + 1);
            }


            //ex.SetCellValue("'" + jl.gtID, row + 3, col + 3);
            //ex.SetCellValue(jl.kywz, row + 3, col + 6);


            //交叉跨越行
            ex.SetCellValue(jl.kygh, row + 6, col);
            ex.SetCellValue(jl.gdjl.ToString(), row + 6, col + 3);
            ex.SetCellValue(jl.kymc, row + 6, col + 4);
            ex.SetCellValue(jl.ssdw, row + 6, col + 5);
            ex.SetCellValue(jl.jb, row + 6, col + 7);
            //测量记录

            ex.ShowExcel();
            for (int j = 1; j <= pageindex; j++) {
                ex.ActiveSheet(j);
                //ex.ReNameWorkSheet(j, "Sheet" + (j));
                int prepageindex = j - 1;
                //主题
                int starow = prepageindex * 15 + 1;
                int endrow = j * 15;

                if (list.Count > endrow) {
                    for (int i = 0; i < 15; i++) {

                        string str = list[starow - 1 + i].clrqz;
                        string[] mans = str.Split(new char[1] { ';' });
                        ex.SetCellValue(list[starow - 1 + i].clrq.Year.ToString(), rowcount + i, col);
                        ex.SetCellValue(list[starow - 1 + i].clrq.Month.ToString(), rowcount + i, col + 1);
                        ex.SetCellValue(list[starow - 1 + i].clrq.Day.ToString(), rowcount + i, col + 2);
                        ex.SetCellValue(list[starow - 1 + i].scz.ToString(), rowcount + i, col + 3);
                        ex.SetCellValue(list[starow - 1 + i].qw, rowcount + i, col + 4);
                        ex.SetCellValue(mans[0], rowcount + i, col + 5);
                        ex.SetCellValue(mans[1], rowcount + i, col + 6);
                        ex.SetCellValue(list[starow - 1 + i].jr, rowcount + i, col + 7);

                    }
                } else if (list.Count <= endrow && list.Count >= starow) {
                    for (int i = 0; i < list.Count - starow + 1; i++) {
                        string str = list[starow - 1 + i].clrqz;
                        string[] mans = str.Split(new char[1] { ';' });
                        ex.SetCellValue(list[starow - 1 + i].clrq.Year.ToString(), rowcount + i, col);
                        ex.SetCellValue(list[starow - 1 + i].clrq.Month.ToString(), rowcount + i, col + 1);
                        ex.SetCellValue(list[starow - 1 + i].clrq.Day.ToString(), rowcount + i, col + 2);
                        ex.SetCellValue(list[starow - 1 + i].scz.ToString(), rowcount + i, col + 3);
                        ex.SetCellValue(list[starow - 1 + i].qw, rowcount + i, col + 4);

                        ex.SetCellValue(mans[0], rowcount + i, col + 5);
                        ex.SetCellValue(mans[1], rowcount + i, col + 6);
                        ex.SetCellValue(list[starow - 1 + i].jr, rowcount + i, col + 7);

                    }
                }

            }
//.........这里部分代码省略.........
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:101,代码来源:Export05.cs

示例12: ExportExcel

        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public static void ExportExcel(IList<PJ_08sbtdjx> objlist)
        {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\08设备停电检修记录.xls";

            ex.Open(fname);
            //此处写填充内容代码
            int rowcount = 5;
            //分页 将要变化的进行分页
            int pageindex = 1;
            if (pageindex < Ecommon.GetPagecount(objlist.Count, 20))
            {
                pageindex = Ecommon.GetPagecount(objlist.Count, 20);
            }
            for (int j = 1; j <= pageindex; j++)
            {
                if (j > 1)
                {
                    ex.CopySheet(1, 1);
                }
            }
            ex.ShowExcel();
            for (int j = 1; j <= pageindex; j++)
            {

                ex.ActiveSheet(j);
                ex.ReNameWorkSheet(j, "Sheet" + (j));
                int prepageindex = j - 1;
                //主题
                int starow = prepageindex * 20 + 1;
                int endrow = j * 20;
                if (objlist.Count > endrow)
                {
                    for (int i = 0; i < 20; i++)
                    {
                        ex.SetCellValue(objlist[starow - 1 + i].tdsj.Month.ToString(), rowcount + i, 1);
                        ex.SetCellValue(objlist[starow - 1 + i].tdsj.Day.ToString(), rowcount + i, 3);
                        ex.SetCellValue(objlist[starow - 1 + i].LineName, rowcount + i, 5);
                        ex.SetCellValue(objlist[starow - 1 + i].jxnr, rowcount + i, 6);
                        ex.SetCellValue(objlist[starow - 1 + i].tdsj.Hour.ToString(), rowcount + i, 7);
                        ex.SetCellValue(objlist[starow - 1 + i].tdsj.Minute.ToString(), rowcount + i, 9);
                        ex.SetCellValue(objlist[starow - 1 + i].sdsj.Hour.ToString(), rowcount + i, 11);
                        ex.SetCellValue(objlist[starow - 1 + i].sdsj.Minute.ToString(), rowcount + i, 13);
                        ex.SetCellValue(objlist[starow - 1 + i].tdxz, rowcount + i, 15);
                        ex.SetCellValue(objlist[starow - 1 + i].gzfzr, rowcount + i, 16);

                    }
                }
                else if (objlist.Count <= endrow && objlist.Count >= starow)
                {
                    for (int i = 0; i < objlist.Count - starow + 1; i++)
                    {
                        ex.SetCellValue(objlist[starow - 1 + i].tdsj.Month.ToString(), rowcount + i, 1);
                        ex.SetCellValue(objlist[starow - 1 + i].tdsj.Day.ToString(), rowcount + i, 3);
                        ex.SetCellValue(objlist[starow - 1 + i].LineName, rowcount + i, 5);
                        ex.SetCellValue(objlist[starow - 1 + i].jxnr, rowcount + i, 6);
                        ex.SetCellValue(objlist[starow - 1 + i].tdsj.Hour.ToString(), rowcount + i, 7);
                        ex.SetCellValue(objlist[starow - 1 + i].tdsj.Minute.ToString(), rowcount + i, 9);
                        ex.SetCellValue(objlist[starow - 1 + i].sdsj.Hour.ToString(), rowcount + i, 11);
                        ex.SetCellValue(objlist[starow - 1 + i].sdsj.Minute.ToString(), rowcount + i, 13);
                        ex.SetCellValue(objlist[starow - 1 + i].tdxz, rowcount + i, 15);
                        ex.SetCellValue(objlist[starow - 1 + i].gzfzr, rowcount + i, 16);

                    }
                }
            }
            ex.ActiveSheet(1);
            string gdsname = "";
            //记录变电所
            if (objlist.Count>0)
            {
                

                gdsname = objlist[0].OrgName;
            }
          
            //工具仪表信息
            //for (int i = 0; i < objlist.Count;i++ )
            //{
            //    ex.SetCellValue(objlist[i].tdsj.Month.ToString(), rowcount + i, 1);
            //    ex.SetCellValue(objlist[i].tdsj.Day.ToString(), rowcount + i, 3);
            //    ex.SetCellValue(objlist[i].LineName, rowcount + i, 5);
            //    ex.SetCellValue(objlist[i].jxnr, rowcount + i, 6);
            //    ex.SetCellValue(objlist[i].tdsj.Hour.ToString(), rowcount + i, 7);
            //    ex.SetCellValue(objlist[i].tdsj.Minute.ToString(), rowcount + i, 9);
            //    ex.SetCellValue(objlist[i].sdsj.Hour.ToString(), rowcount + i,11);
            //    ex.SetCellValue(objlist[i].sdsj.Minute.ToString(), rowcount + i, 13);
            //    ex.SetCellValue(objlist[i].tdxz, rowcount + i, 15);
            //    ex.SetCellValue(objlist[i].gzfzr, rowcount + i, 16);
                
            //}
           ex.ShowExcel();
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:98,代码来源:Export08.cs

示例13: ExportGDSRKDExcel

        /// <summary>
        /// 导出入库单
        /// </summary>
        /// <param name="orgCode"></param>
        /// <param name="jingbanren"></param>
        public void ExportGDSRKDExcel(string orgCode, string sql)
        {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\供电所材料出入库明细.xls";
            ex.Open(fname);

            string orgname = (string)ClientHelper.PlatformSqlMap.GetObject("SelectOneStr", "select top 1 OrgName from mOrg where OrgCode='" + orgCode + "'");

            ex.SetCellValue(orgname, 3, 3);

            IList<PJ_gdscrk> datalist = ClientHelper.PlatformSqlMap.GetList<PJ_gdscrk>(sql);

            if (datalist.Count <= 0)
            {
                return;
            }
            #region 开始导出
            //此处写填充内容代码
            int row = 5;
            int col = 1;
            int rowcount = 46;
            if (datalist.Count < 1) return;
            Regex r1 = new Regex("[0-9]+");
            string str = r1.Match(datalist[0].num).Value;
            if (str == "")
            {
                str = datalist[0].num;
            }
            string tablename = "供电所材料出入库明细";
            if (tablename.Length > 30)
            {
                tablename = tablename.Substring(tablename.Length - 31);
            }
            //
            //加页
            int pageindex = 1;
            if (pageindex < Ecommon.GetPagecount(datalist.Count, rowcount))
            {
                pageindex = Ecommon.GetPagecount(datalist.Count, rowcount);
            }

            for (int j = 1; j < pageindex; j++)
            {
                ex.CopySheet(1, j);
                ex.ReNameWorkSheet(j + 1, tablename + "(" + (j) + ")");
            }
            for (int j = 0; j < datalist.Count; j++)
            {
                if (j % rowcount == 0)
                {
                    if (j == 0) ex.ActiveSheet(tablename);
                    else ex.ActiveSheet(tablename + "(" + (j / rowcount + 1) + ")");
                }
                // 填值
                ex.SetCellValue((j + 1).ToString(), row + j % rowcount, col);

                if (datalist[j].type == "出库")
                {
                    ex.SetCellValue(datalist[j].ckdate.ToString("yyyy年MM月dd日"), row + j % rowcount, col + 1);
                    ex.SetCellValue(datalist[j].cksl, row + j % rowcount, col + 6);
                }
                else
                {
                    ex.SetCellValue(datalist[j].indate.ToString("yyyy年MM月dd日"), row + j % rowcount, col + 1);
                    ex.SetCellValue(datalist[j].wpsl, row + j % rowcount, col + 5);
                }
                ex.SetCellValue(datalist[j].wpmc, row + j % rowcount, col + 2);
                ex.SetCellValue(datalist[j].wpgg, row + j % rowcount, col + 3);
                ex.SetCellValue(datalist[j].wpdw, row + j % rowcount, col + 4);
                ex.SetCellValue(datalist[j].kcslcount, row + j % rowcount, col + 7);
            }
            #endregion
            ex.ShowExcel();
        }
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:80,代码来源:ExportGDSCRKDetial.cs

示例14: ExportExcel

        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public static void ExportExcel(PS_kg obj) {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\12线路开关卡片";

            ex.Open(fname);
            //此处写填充内容代码
            int pagecount = 1;
            string strwhere1 = " where kgID='" + obj.kgID + "'";
            IList<PJ_12kgbd> pjbdlist = Client.ClientHelper.PlatformSqlMap.GetList<PJ_12kgbd>("SelectPJ_12kgbdList", strwhere1);
            IList<PJ_12kgjx> pjjxlist = Client.ClientHelper.PlatformSqlMap.GetList<PJ_12kgjx>("SelectPJ_12kgjxList", strwhere1);
            IList<PJ_12kgsy> pjsylist = Client.ClientHelper.PlatformSqlMap.GetList<PJ_12kgsy>("SelectPJ_12kgsyList", strwhere1);
            if (Ecommon.GetPagecount(pjbdlist.Count, 14) > pagecount)
            {
                pagecount = Ecommon.GetPagecount(pjbdlist.Count, 14);
            }
            if (Ecommon.GetPagecount(pjjxlist.Count, 15) > pagecount)
            {
                pagecount = Ecommon.GetPagecount(pjjxlist.Count, 15);
            }
            if (Ecommon.GetPagecount(pjsylist.Count, 3) > pagecount)
            {
                pagecount = Ecommon.GetPagecount(pjsylist.Count, 3);
            }
            //复制空模版
            if (pagecount > 1)
            {
                for (int i = 1; i < pagecount; i++)
                {
                    ex.CopySheet(1, i);
                    ex.ReNameWorkSheet(i + 1, "Sheet" + (i + 1));
                }
            }

            for (int p = 0; p < pagecount; p++)
            {
                ex.ActiveSheet(p + 1);
                //变动记录
                for (int i = 0; i < 14; i++)
                {
                    if (p*14+i>=pjbdlist.Count)
                    {
                        break;
                    }
                    PJ_12kgbd tempobj = pjbdlist[p * 14 + i];
                    ex.SetCellValue(tempobj.azrq.Year.ToString(), 12 + 2 * i, 1);
                    ex.SetCellValue(tempobj.azrq.Month.ToString(), 12 +2 * i, 3);
                    ex.SetCellValue(tempobj.azrq.Day.ToString(), 12 + 2 * i, 5);
                    ex.SetCellValue(tempobj.azdd, 12 + 2 * i, 7);
                    ex.SetCellValue(tempobj.gtbh, 12 + 2 * i, 9);
                    ex.SetCellValue("'"+tempobj.kgCode, 12 + 2 * i,10);
                    ex.SetFontNameSize(12 + 2 * i, 10, 12 + 2 * i, 10, "", 9);
                    //如果日期未写不不输出 {1900-1-1 0:00:00}
                    DateTime dtCCRQ =DateTime.Parse("1900-1-1 0:00:00");
                    if (tempobj.ccrq != dtCCRQ)
                    {

                        ex.SetCellValue(tempobj.ccrq.Year.ToString(), 12 + 2 * i, 11);
                        ex.SetCellValue(tempobj.ccrq.Month.ToString(), 12 + 2 * i, 13);
                        ex.SetCellValue(tempobj.ccrq.Day.ToString(), 12 + 2 * i, 15);
                    }
                    ex.SetCellValue(tempobj.ccyy, 12 + 2 * i, 17);
                    ex.SetCellValue(tempobj.Remark, 12 + 2 * i, 19);
                }

                //实验记录
                for (int j = 0; j < 3; j++)
                {
                    if (p*3+j>=pjsylist.Count)
                    {
                        break;
                    }
                    PJ_12kgsy tempobj = pjsylist[p * 3 + j];

                    ex.SetCellValue(tempobj.azrq.Year.ToString(), 4, 27 + j * 6);
                    ex.SetCellValue(tempobj.azrq.Month.ToString(), 4, 29 + j * 6);
                    ex.SetCellValue(tempobj.azrq.Day.ToString(), 4, 31 + j * 6);

                    ex.SetCellValue(tempobj.azdd, 5, 27 + j * 6);
                    ex.SetCellValue(tempobj.gtbh, 6, 27 + j * 6);

                    ex.SetCellValue(tempobj.A_BCO, 7, 27 + j * 6);
                    ex.SetCellValue(tempobj.B_CAO, 8, 27 + j * 6);
                    ex.SetCellValue(tempobj.C_ABO, 9, 27 + j * 6);

                    ex.SetCellValue(tempobj.A_BCO2, 10, 27 + j * 6);
                    ex.SetCellValue(tempobj.B_CAO2, 11, 27 + j * 6);
                    ex.SetCellValue(tempobj.C_ABO2, 12, 27 + j * 6);

                    ex.SetCellValue(tempobj.dy, 13, 27 + j * 6);
                    ex.SetCellValue(tempobj.dysj, 14, 27 + j * 6);

                    ex.SetCellValue(tempobj.dl, 15, 27 + j * 6);
                    ex.SetCellValue(tempobj.dlsj, 16, 27 + j * 6);

                    ex.SetCellValue(tempobj.dzA, 17, 27 + j * 6);
//.........这里部分代码省略.........
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:101,代码来源:Export12.cs

示例15: ExportExcel

        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public static void ExportExcel(PJ_09pxjl obj) {
            //lgm
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\09培训记录.xls";

            ex.Open(fname);
            //每行显示文字长度
            int zc = 60;
            //与会人员之间的间隔符号
            char[] jksign = new char[1] { ';' };
            int row = 1;
            int col = 1;
            //计算页码
            int pagecount = 1;

            //题目
            string timustr = "题目:";
            List<string> timulist = Ecommon.ResultStrListByPage(timustr, obj.tm, zc, 4);
            if (Ecommon.GetPagecount(timulist.Count, 4) > pagecount) {
                pagecount = Ecommon.GetPagecount(timulist.Count, 4);
            }
            //活动内容
            string hdstr = "内容:";
            List<string> hdlist = Ecommon.ResultStrListByPage(hdstr, obj.nr, zc, 10);
            if (Ecommon.GetPagecount(hdlist.Count, 10) > pagecount) {
                pagecount = Ecommon.GetPagecount(hdlist.Count, 10);
            }
            //领导评语
            string ldpystr = "领导检查评语:";
            List<string> ldpylist = Ecommon.ResultStrListByPage(ldpystr, obj.py, zc, 3);
            if (Ecommon.GetPagecount(ldpylist.Count, 3) > pagecount) {
                pagecount = Ecommon.GetPagecount(ldpylist.Count, 3);
            }
            //复制空模板
            for (int m = 1; m < pagecount; m++) {
                ex.CopySheet(1, m);
                ex.ReNameWorkSheet(m + 1, "Sheet" + (m + 1));
            }

            for (int p = 0; p < pagecount; p++) {
                ex.ActiveSheet(p + 1);

                //题目

                for (int i = 0; i < 4; i++) {
                    if (p * 4 + i >= timulist.Count) {
                        break;
                    }
                    string tempstr = timulist[p * 4 + i];
                    ex.SetCellValue(tempstr, 7 + i, 1);
                }
                //活动内容

                for (int r = 0; r < 10; r++) {
                    if (p * 10 + r >= hdlist.Count) {
                        break;
                    }
                    string tempstr = hdlist[p * 10 + r];
                    ex.SetCellValue(tempstr, 11 + r, 1);
                }

                //领导评语

                for (int t = 0; t < 3; t++) {
                    if (p * 3 + t >= ldpylist.Count) {
                        break;
                    }
                    string tempstr = ldpylist[p * 3 + t];
                    ex.SetCellValue(tempstr, 21 + t, 1);
                }


            }

            ex.ActiveSheet(1);

            //培训时间
            row = 2;
            ex.SetCellValue(obj.rq.Year.ToString(), 4, 2);

            ex.SetCellValue(obj.rq.Month.ToString(), 4, 4);

            ex.SetCellValue(obj.rq.Day.ToString(), 4, 6);
            //学习时数
            string[] ary = obj.xxss.Split(jksign);
            if (ary.Length >= 1) {
                ex.SetCellValue(ary[0], 4, 9);
            } else {
                ex.SetCellValue("", 4, 9);
            }
            if (ary.Length >= 2) {
                ex.SetCellValue(ary[1], 4, 11);
            } else {
                ex.SetCellValue("", 4, 11);
            }
//.........这里部分代码省略.........
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:101,代码来源:Export09.cs


注:本文中的ExcelAccess.CopySheet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。