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


C# ExcelAccess.SetFontNameSize方法代码示例

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


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

示例1: 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


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