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


C# Microsoft.Office.Interop.Excel.TryGetSheet方法代码示例

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


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

示例1: InitModuleObjectRanges

        public override void InitModuleObjectRanges(InteropExcel.Workbook ActiveWorkbook, bool AddToWorkbook = false)
        {
            string formula = string.Empty;
            rngp_Uploader = new ObjectRange();
            rngp_Uploader.InitRange(ActiveWorkbook, "_parameter", "TeamFile_rngUploader", "=_parameter!$A$1", AddToWorkbook);

            rngp_LastUpload = new ObjectRange();
            rngp_LastUpload.InitRange(ActiveWorkbook, "_parameter", "TeamFile_rngLastUpload", "=_parameter!$A$2", AddToWorkbook);

            rngp_LastDownload = new ObjectRange();
            rngp_LastDownload.InitRange(ActiveWorkbook, "_parameter", "TeamFile_rngLastDownload", "=_parameter!$A$3", AddToWorkbook);

            rngp_NameList = new ObjectRange();
            formula = @"=INDIRECT(""refNameList!$A$1:$F""&MAX(1;COUNTA(refNameList!$A$1:$A$5000)))";
            rngp_NameList.InitRange(ActiveWorkbook, "refNameList", "TeamFile_rngNameList", formula, AddToWorkbook);

            rngNames = new ObjectRange();
            formula = @"=INDIRECT(""refNameList!$A$1:$A""&MAX(1;COUNTA(refNameList!$A$1:$A$5000)))";
            rngNames.InitRange(ActiveWorkbook, "refNameList", "NameList", formula, AddToWorkbook);

            rngcl_CurrentTeamLS = new ObjectRange();
            formula = @"=INDIRECT(""Team!$G$13:$G190"")";
            rngcl_CurrentTeamLS.InitRange(ActiveWorkbook, "Team", "TeamFile_rngCurrentTeamLS", formula, AddToWorkbook);

            rngcl_CurrentTeamWOLS = new ObjectRange();
            formula = @"=INDIRECT(""Team!$H$13:$H190"")";
            rngcl_CurrentTeamWOLS.InitRange(ActiveWorkbook, "Team", "TeamFile_rngCurrentTeamWOLS", formula, AddToWorkbook);

            rngcl_AdditionalAllocationLS = new ObjectRange();
            formula = @"=INDIRECT(""Team!$I$13:$I190"")";
            rngcl_AdditionalAllocationLS.InitRange(ActiveWorkbook, "Team", "TeamFile_rngAdditionalAllocationLS", formula, AddToWorkbook);

            rngcl_AdditionalAllocationWOLS = new ObjectRange();
            formula = @"=INDIRECT(""Team!$J$13:$J190"")";
            rngcl_AdditionalAllocationWOLS.InitRange(ActiveWorkbook, "Team", "TeamFile_rngAdditionalAllocationWOLS", formula, AddToWorkbook);

            rngcl_BridgeCurrentTeam= new ObjectRange();
            formula = @"=INDIRECT(""Team!$E$13:$E190"")";
            rngcl_BridgeCurrentTeam.InitRange(ActiveWorkbook, "Team", "TeamFile_rngBridgeCurrentTeam", formula, AddToWorkbook);

            rngcl_PlanningArea = new ObjectRange();
            formula = @"=INDIRECT(""Team!$A$13:$T190"")";
            rngcl_PlanningArea.InitRange(ActiveWorkbook, "Team", "TeamFile_rngPlanningArea", formula, AddToWorkbook);

            rngcl_NameFixed = new ObjectRange();
            formula = @"=INDIRECT(""Team!$B$13:$B190"")";
            rngcl_NameFixed.InitRange(ActiveWorkbook, "Team", "TeamFile_rngNameFixed", formula, AddToWorkbook);

            rngcl_PlanningAreaFixed = new ObjectRange();
            formula = @"=INDIRECT(""Team!$A$13:$W190"")";
            rngcl_PlanningAreaFixed.InitRange(ActiveWorkbook, "Team", "TeamFile_rngPlanningAreaFixed", formula, AddToWorkbook);

            rngcl_Comment = new ObjectRange();
            formula = @"=INDIRECT(""Team!$T$13:$T190"")";
            rngcl_Comment.InitRange(ActiveWorkbook, "Team", "TeamFile_rngComment", formula, AddToWorkbook);

            rngcl_DateFrom = new ObjectRange();
            formula = @"=INDIRECT(""Team!$K$13:$K190"")";
            rngcl_DateFrom.InitRange(ActiveWorkbook, "Team", "TeamFile_rngDateFrom", formula, AddToWorkbook);

            rngcl_DateTo = new ObjectRange();
            formula = @"=INDIRECT(""Team!$L$13:$L190"")";
            rngcl_DateTo.InitRange(ActiveWorkbook, "Team", "TeamFile_rngDateTo", formula, AddToWorkbook);

            rngcl_Name = new ObjectRange();
            formula = @"=INDIRECT(""Team!$B$13:$B190"")";
            rngcl_Name.InitRange(ActiveWorkbook, "Team", "TeamFile_rngName", formula, AddToWorkbook);

            rngcl_Status = new ObjectRange();
            formula = @"=INDIRECT(""Team!$W$13:$W190"")";
            rngcl_Status.InitRange(ActiveWorkbook, "Team", "TeamFile_rngStatus", formula, AddToWorkbook);

            rngcl_MessageHeader = new ObjectRange();
            rngcl_MessageHeader.InitRange(ActiveWorkbook, "Team", "TeamFile_rngMessageHeader", "=Team!$A$11", AddToWorkbook);

            rngcl_Message = new ObjectRange();
            rngcl_Message.InitRange(ActiveWorkbook, "Team", "TeamFile_rngMessage", "=Team!$C$11", AddToWorkbook);

            rngp_ManagerList = new ObjectRange();
            formula = @"=INDIRECT(""_parameter!$F$1:$F""&MAX(1;COUNTA(_parameter!$F$1:$G$100)))";
            rngp_ManagerList.InitRange(ActiveWorkbook, "_parameter", "TeamFile_rngManagerList", formula, AddToWorkbook);

            rngp_TemplateUpdate = new ObjectRange();
            formula = @"=INDIRECT(""_parameter!$U$1:$U""&MAX(1;COUNTA(_parameter!$U$1:$U$100)))";
            rngp_TemplateUpdate.InitRange(ActiveWorkbook, "_parameter", "TeamFile_rngTemlateUpdate", formula, AddToWorkbook);

            rngp_Target = new ObjectRange();
            formula = @"=INDIRECT(""refTarget!$A$1:$B""&MAX(1;COUNTA(refTarget!$B$1:$B$500)))";
            rngp_Target.InitRange(ActiveWorkbook, "refTarget", "TeamFile_rngTarget", formula, AddToWorkbook);

            //TeamFileModuleTemplateUpdates updates = new TeamFileModuleTemplateUpdates();
            //TemplateUpdater.RunUpdates(updates, rngp_TemplateUpdate.GetRange());

            _SqlSatementModule.InitModuleObjectRanges(ActiveWorkbook, AddToWorkbook);
            var wsTeam = ActiveWorkbook.TryGetSheet("Team");
            if (wsTeam != null)
            {
                wsTeam.EnableOutlining = true;
                wsTeam.Protect("materia", AllowFiltering: true, UserInterfaceOnly: true);
            }
//.........这里部分代码省略.........
开发者ID:PSDevGithub,项目名称:PSExcelAddin2010,代码行数:101,代码来源:TeamFileModule.cs


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