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


C# ExcelAccess.DeleteWorkSheet方法代码示例

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


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

示例1: ExportExceldt

        /// <summary>
        /// 文档格式预定义好的,动态填写内容
        /// </summary>
        /// <param name="obj"></param>
        public static void ExportExceldt(string obj)
        {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\10配电变压器汇总表.xls";
            ex.Open(fname );
            IList list=new  ArrayList ();
            int pagecount=0;
            //obj = "317";
            string strfilter = " and 1=1";
            if (obj != "") strfilter = strfilter + " and a.OrgCode='" + obj+"' ";
            IList caplist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneInt", "select distinct  b.byqCapcity    from dbo.mOrg a,dbo.PS_tqbyq b,dbo.PS_xl c, dbo.PS_tq d where a.OrgCode=c.OrgCode and c.LineCode=d.xlCode and d.tqID=b.tqID  " + strfilter + " order by b.byqCapcity");
            //caplist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", string.Format("select nr from pj_dyk where  len(parentid)>1 and dx='{0}' and sx='{1}'", "11配电变压器卡片", "容量"));
            //IList modmflist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct  UPPER(replace(b.byqModle,'-'+cast(b.byqCapcity as nvarchar(50))+'/'+cast(b.byqVol  as nvarchar(50)),'')) from dbo.mOrg a,dbo.PS_tqbyq b,dbo.PS_xl c, dbo.PS_tq d where a.OrgCode=c.OrgCode and c.LineCode=d.xlCode and d.tqID=b.tqID   " + strfilter + " and b.omniseal='true'");
            //IList modtmlist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct  UPPER(replace(b.byqModle,'-'+cast(b.byqCapcity as nvarchar(50))+'/'+cast(b.byqVol  as nvarchar(50)),'')) from dbo.mOrg a,dbo.PS_tqbyq b,dbo.PS_xl c, dbo.PS_tq d where a.OrgCode=c.OrgCode and c.LineCode=d.xlCode and d.tqID=b.tqID   " + strfilter + " and (b.omniseal!='true' or b.omniseal is null)");
            IList modmflist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct  UPPER(b.byqModle) from dbo.mOrg a,dbo.PS_tqbyq b,dbo.PS_xl c, dbo.PS_tq d where a.OrgCode=c.OrgCode and c.LineCode=d.xlCode and d.tqID=b.tqID   " + strfilter + " and b.omniseal='true'");
            IList modtmlist = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr", "select distinct  UPPER(b.byqModle) from dbo.mOrg a,dbo.PS_tqbyq b,dbo.PS_xl c, dbo.PS_tq d where a.OrgCode=c.OrgCode and c.LineCode=d.xlCode and d.tqID=b.tqID   " + strfilter + " and (b.omniseal!='true' or b.omniseal is null)");
            int jmax = 18;
            int i = 0;
            for ( i = 0; i < modmflist.Count; i++)
            {
                if (modmflist[i].ToString().IndexOf("-")>-1)
                {
                    modmflist[i] = modmflist[i].ToString().Substring(0,modmflist[i].ToString().IndexOf("-"));
                }
            }
            for (i = 0; i < modtmlist.Count; i++)
            {
                if (modtmlist[i].ToString().IndexOf("-")>-1)
                {
                    modtmlist[i] = modtmlist[i].ToString().Substring(0, modtmlist[i].ToString().IndexOf("-"));
                }
            }
            string modtemp = "";
            for (i = 0; i < modmflist.Count; i++)
            {
                if (modtemp.IndexOf(modmflist[i].ToString())==-1)
                {
                    if (modtemp!="")
                        modtemp+=","+modmflist[i];
                    else
                        modtemp = modmflist[i].ToString();
                }
            }
            if (modtemp != "")
            {
                string[] strli = modtemp.Split(',');
                modmflist.Clear();
                
                for (i = 0; i < strli.Length; i++)
                {
                    modmflist.Add(strli[i]);
                }
            }
            for (i = 0; i < modtmlist.Count; i++)
            {
                if (modtemp.IndexOf(modtmlist[i].ToString()) == -1)
                {
                    if (modtemp!="")
                        modtemp += "," + modtmlist[i];
                    else
                        modtemp = modtmlist[i].ToString();
                }
            }
            if (modtemp != "")
            {
                string[] strli = modtemp.Split(',');
                modtmlist.Clear();
                for (i = 0; i < strli.Length; i++)
                {
                    modtmlist.Add(strli[i]);
                }
            }
                pagecount = (int)Math.Ceiling(caplist.Count / (jmax + 0.0));
            int itemp = modtmlist.Count / 6.0 > modmflist.Count / 3.0 ? (int)Math.Ceiling(modtmlist.Count / 6.0) : (int)Math.Ceiling(modmflist.Count / 3.0 );
            
            pagecount = itemp * pagecount;
            if (pagecount > 1)
            {
                ex.DeleteWorkSheet("Sheet2");
                ex.DeleteWorkSheet("Sheet3"); 
            }
            /////计算需要多少个工作表
            for (i = 1; i < pagecount; i++)
            {
               
               
                ex.CopySheet(1,i);
                ex.ReNameWorkSheet((i + 1), "Sheet" + (i + 1));
               
            }
            int istart = 7, istart2 = 19, jstart = 4, j=0;
            string jstrfilter="";
            mOrg org = Client.ClientHelper.PlatformSqlMap.GetOneByKey<mOrg>(obj);
            for ( j = 0; j < caplist.Count; j++)
            {
//.........这里部分代码省略.........
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:101,代码来源:Export10.cs


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