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


C# Application.OpenWorkbook方法代码示例

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


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

示例1: OnSerializingMethodNegativeTest

        public void OnSerializingMethodNegativeTest()
        {
            Application application = new Application();

            try
            {
                Workbook book = application.OpenWorkbook("WorkbookTestData.xlsx", false);

                // Where ever we are creating object for WorkflowController_Accessor, we need to set the ThisAddIn_Accessor.ExcelApplication to
                // wither null or actual application object.
                ThisAddIn_Accessor.ExcelApplication = application;

                using (WorkflowController_Accessor target = new WorkflowController_Accessor())
                {
                    Common.Globals_Accessor.wwtManager = new WWTManager(new WWTMockRequest());
                    Common.Globals_Accessor.TargetMachine = new TargetMachine("localhost");
                    target.OnWorkbookOpen(book);

                    target.currentWorkbookMap.SelectedLayerMap.RangeName.RefersTo = null;

                    Assert.IsNotNull(target.currentWorkbookMap.SelectedLayerMap);
                    StreamingContext context = new StreamingContext();
                    target.currentWorkbookMap.OnSerializingMethod(context);
                    Assert.IsNull(target.currentWorkbookMap.SelectedLayerMap);
                }
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:31,代码来源:WorkbookMapTest.cs

示例2: CleanUpWWTLayersTest

        public void CleanUpWWTLayersTest()
        {
            Application application = new Application();
            try
            {
                Workbook book = application.OpenWorkbook("WorkbookTestData.xlsx", false);
                Name emptyRange = book.Names.GetNamedRange("GetSelectedLayerWorksheet");

                Common.Globals_Accessor.wwtManager = new WWTManager(new WWTMockRequest());
                Common.Globals_Accessor.TargetMachine = new TargetMachine("localhost");

                Group marsGroup = new Group("Mars", GroupType.ReferenceFrame, null);
                Group sunGroup = new Group("Sun", GroupType.ReferenceFrame, null);
                Group earthGroup = new Group("Earth", GroupType.ReferenceFrame, sunGroup);
                earthGroup.LayerIDs.Add("8e5cbbc4-9eb2-47e5-b3d7-7ca9babda477");
                sunGroup.Children.Add(earthGroup);

                LayerMap earthLayer = new LayerMap(new Layer());
                earthLayer.MapType = LayerMapType.WWT;
                earthLayer.LayerDetails.Group = earthGroup;
                earthLayer.LayerDetails.ID = "ValidID1";

                LayerMap marsLayer = new LayerMap(emptyRange);
                marsLayer.MapType = LayerMapType.LocalInWWT;
                marsLayer.LayerDetails.Group = marsGroup;
                marsLayer.LayerDetails.ID = "MarsValidID1";

                LayerMap sunLayer = new LayerMap(emptyRange);
                sunLayer.MapType = LayerMapType.LocalInWWT;
                sunLayer.LayerDetails.Group = sunGroup;
                sunLayer.LayerDetails.ID = "sunLayerID1";

                WorkbookMap workbookMap = new WorkbookMap(null);
                workbookMap.AllLayerMaps.Add(earthLayer);
                workbookMap.AllLayerMaps.Add(marsLayer);
                workbookMap.AllLayerMaps.Add(sunLayer);

                workbookMap.SelectedLayerMap = earthLayer;

                WorkbookMapExtensions.CleanUpWWTLayers(workbookMap);
                Assert.IsNull(workbookMap.SelectedLayerMap);
                Assert.IsTrue(workbookMap.AllLayerMaps.Count == 2);
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:48,代码来源:WorkbookMapExtensionsTest.cs

示例3: GetNamedRangeTest

        public void GetNamedRangeTest()
        {
            Application application = new Application();

            try
            {
                Workbook book = application.OpenWorkbook("WorkbookTestData.xlsx", false);
                Names namedCollection = book.Names;
                Name expected = book.Names.GetNamedRange("InsertRows");

                string rangeName = "InsertRows";
                Name actual = namedCollection.GetNamedRange(rangeName);
                Assert.AreEqual(expected, actual);
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:19,代码来源:NameExtensionsTest.cs

示例4: CleanLayerMapTest

        public void CleanLayerMapTest()
        {
            Application application = new Application();

            try
            {
                Workbook book = application.OpenWorkbook("WorkbookTestData.xlsx", false);

                // Where ever we are creating object for WorkflowController_Accessor, we need to set the ThisAddIn_Accessor.ExcelApplication to
                // wither null or actual application object.
                ThisAddIn_Accessor.ExcelApplication = application;

                using (WorkflowController_Accessor target = new WorkflowController_Accessor())
                {
                    Common.Globals_Accessor.wwtManager = new WWTManager(new WWTMockRequest());
                    Common.Globals_Accessor.TargetMachine = new TargetMachine("localhost");
                    target.OnNewWorkbook(book);

                    Name namedRange = book.Names.GetNamedRange("TestProperties_1");
                    namedRange.RefersTo = null;

                    // CurrentWorkbookMap cannot be accessed directly through WorkflowController_Accessor object.
                    WorkbookMap currentWorkbookMap = target.currentWorkbookMap.Target as WorkbookMap;

                    // Before making call to CleanLayerMap method, AllLayerMaps count should be 1.
                    Assert.AreEqual(currentWorkbookMap.AllLayerMaps.Count, 2);

                    Addin.WorkbookExtensions_Accessor.CleanLayerMap(book, target.currentWorkbookMap);

                    // After the call to CleanLayerMap method, AllLayerMaps count should be 0.
                    Assert.AreEqual(currentWorkbookMap.AllLayerMaps.Count, 1);
                }
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:38,代码来源:WorkbookExtensionsTest.cs

示例5: OnCustomTaskPaneChangedStateTest

        public void OnCustomTaskPaneChangedStateTest()
        {
            Application application = new Application();

            try
            {
                Workbook book = application.OpenWorkbook("TestData.xlsx", false);

                WorkflowController_Accessor target = GetWorkflowControllerAccessor(application);
                target.currentWorkbookMap = new WorkbookMap_Accessor(book);

                // Get the named range stored in the test data excel file.
                Name name = book.Names.GetNamedRange("ColumnList");
                Group parentGroup = new Group("Sun", GroupType.ReferenceFrame, null);

                Common.Globals_Accessor.wwtManager = new WWTManager(new WWTMockRequest());
                Common.Globals_Accessor.TargetMachine = new TargetMachine("localhost");

                LayerMap_Accessor localLayerMap = new LayerMap_Accessor(name);
                localLayerMap.LayerDetails.Name = "Layer";
                localLayerMap.LayerDetails.Group = parentGroup;
                localLayerMap.MapType = LayerMapType.LocalInWWT;

                target.currentWorkbookMap.SelectedLayerMap = localLayerMap;
                target.layerDetailsViewModel = new LayerDetailsViewModel();

                target.layerDetailsViewModel.ColumnsView = new System.Collections.ObjectModel.ObservableCollection<ColumnViewModel>();
                target.layerDetailsViewModel.ColumnsView.Add(new ColumnViewModel()
                {
                    ExcelHeaderColumn = "Header",
                    SelectedWWTColumn = new Column(ColumnType.Alt, "ss", new System.Collections.ObjectModel.Collection<string>() { "s" })
                });

                LayerMap currentLayer = new LayerMap(name);
                currentLayer.LayerDetails.Name = "Layer";
                currentLayer.LayerDetails.Group = parentGroup;
                currentLayer.MapType = LayerMapType.LocalInWWT;

                target.layerDetailsViewModel.Currentlayer = currentLayer;
                target.layerDetailsViewModel.SelectedLayerName = "Layer1";
                target.layerDetailsViewModel.SelectedGroup = parentGroup;
                target.layerDetailsViewModel.IsDistanceVisible = true;
                target.layerDetailsViewModel.SelectedDistanceUnit = new KeyValuePair<AltUnit, string>(AltUnit.AstronomicalUnits, "Alt");
                target.layerDetailsViewModel.IsRAUnitVisible = true;
                target.layerDetailsViewModel.SelectedFadeType = new KeyValuePair<FadeType, string>(FadeType.Both, "f");
                target.layerDetailsViewModel.SelectedScaleType = new KeyValuePair<ScaleType, string>(ScaleType.Constant, "Constant");
                target.layerDetailsViewModel.SelectedScaleRelative = new KeyValuePair<ScaleRelativeType, string>(ScaleRelativeType.Screen, "Screen");
                target.layerDetailsViewModel.ScaleFactor.SelectedSliderValue = 10;
                target.layerDetailsViewModel.LayerOpacity.SelectedSliderValue = 10;
                target.layerDetailsViewModel.SelectedSize = new KeyValuePair<int, string>(1, "2");
                target.layerDetailsViewModel.SelectedHoverText = new KeyValuePair<int, string>(1, "2");

                object sender = null;
                EventArgs e = null;
                target.OnCustomTaskPaneChangedState(sender, e);

                Assert.AreEqual(target.currentWorkbookMap.SelectedLayerMap.LayerDetails.Group, parentGroup);
                Assert.AreEqual(target.currentWorkbookMap.SelectedLayerMap.name, localLayerMap.name);
                Assert.AreEqual(target.currentWorkbookMap.SelectedLayerMap.LayerDetails.AltUnit, target.layerDetailsViewModel.SelectedDistanceUnit.Key);
                Assert.AreEqual(target.currentWorkbookMap.SelectedLayerMap.LayerDetails.FadeType, target.layerDetailsViewModel.SelectedFadeType.Key);
                Assert.AreEqual(target.currentWorkbookMap.SelectedLayerMap.LayerDetails.PointScaleType, target.layerDetailsViewModel.SelectedScaleType.Key);
                Assert.AreEqual(target.currentWorkbookMap.SelectedLayerMap.LayerDetails.MarkerScale, target.layerDetailsViewModel.SelectedScaleRelative.Key);
                Assert.AreEqual(target.currentWorkbookMap.SelectedLayerMap.LayerDetails.ScaleFactor, 0.125);
                Assert.AreEqual(target.currentWorkbookMap.SelectedLayerMap.LayerDetails.Opacity, target.layerDetailsViewModel.LayerOpacity.SelectedSliderValue / 100);
                Assert.AreEqual(target.currentWorkbookMap.SelectedLayerMap.LayerDetails.SizeColumn, target.layerDetailsViewModel.SelectedSize.Key);
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:71,代码来源:WorkflowControllerTest.cs

示例6: CreateGroupInWWTTest

        public void CreateGroupInWWTTest()
        {
            Application application = new Application();

            try
            {
                Workbook book = application.OpenWorkbook("TestData.xlsx", false);
                WorkflowController_Accessor target = GetWorkflowControllerAccessor(application);
                target.currentWorkbookMap = new WorkbookMap_Accessor(book);

                Common.Globals_Accessor.wwtManager = new WWTManager(new WWTMockRequest());
                Common.Globals_Accessor.TargetMachine = new TargetMachine("localhost");

                // Get the named range stored in the test data excel file.
                Name name = book.Names.GetNamedRange("ColumnList");
                Group parentGroup = new Group("Sun", GroupType.ReferenceFrame, null);
                Group childGroup = new Group("Earth", GroupType.LayerGroup, parentGroup);

                LayerMap_Accessor wwtLayerMap = new LayerMap_Accessor(name);
                wwtLayerMap.LayerDetails.Name = "Layer";
                wwtLayerMap.LayerDetails.ID = "754becad-8e2c-4452-b7e9-55827d4d2786";
                wwtLayerMap.LayerDetails.Group = childGroup;
                wwtLayerMap.MapType = LayerMapType.WWT;

                bool expected = true;
                bool actual = WorkflowController_Accessor.CreateGroupInWWT(wwtLayerMap);
                Assert.AreEqual(expected, actual);
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:33,代码来源:WorkflowControllerTest.cs

示例7: InsertRowsTest

        public void InsertRowsTest()
        {
            Application application = new Application();

            try
            {
                Workbook book = application.OpenWorkbook("TestData.xlsx", false);

                // Get the named range stored in the test data excel file.
                // This range contains first two rows referred with address "$A$1:$E$2".
                Name name = book.Names.GetNamedRange("InsertRows");

                WorkflowController_Accessor target = GetWorkflowControllerAccessor(application);

                target.InsertRows(name.RefersToRange);

                // After two rows are inserted, address of the named range will change to "$A$3:$E$4".
                Assert.AreEqual("$A$3:$E$4", name.RefersToRange.Address);
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:24,代码来源:WorkflowControllerTest.cs

示例8: SetFormatForDateColumnsTest

        public void SetFormatForDateColumnsTest()
        {
            Application application = new Application();

            try
            {
                Workbook book = application.OpenWorkbook("WorkbookTestData.xlsx", false);
                WorkflowController_Accessor target = GetWorkflowControllerAccessor(application);
                Common.Globals_Accessor.wwtManager = new WWTManager(new WWTMockRequest());
                Common.Globals_Accessor.TargetMachine = new TargetMachine("localhost");

                Name name = book.Names.GetNamedRange("SetFormatForDateColumns_1");

                foreach (Range cell in name.RefersToRange.Range["D2:E6"])
                {
                    Assert.AreEqual(cell.NumberFormat, "m/d/yyyy");
                }

                target.OnWorkbookOpen(book);

                target.SetFormatForDateColumns(book.ActiveSheet);

                foreach (Range cell in name.RefersToRange.Range["D2:E6"])
                {
                    Assert.AreEqual(cell.NumberFormat, "m/d/yyyy h:mm");
                }
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:32,代码来源:WorkflowControllerTest.cs

示例9: GotoViewpointOnViewInWWTTestSky

        public void GotoViewpointOnViewInWWTTestSky()
        {
            Application application = new Application();
            bool createdWtmlKey = false;

            try
            {
                createdWtmlKey = CreateWwtKeyIfNotExists();
                Workbook book = application.OpenWorkbook("WorkbookTestData.xlsx", false);
                Name namedRange = book.Names.GetNamedRange("GotoViewpointOnViewInWWTSky");

                Common.Globals_Accessor.wwtManager = new WWTManager(new WWTMockRequest());
                Common.Globals_Accessor.TargetMachine = new TargetMachine("localhost");

                Group skyGroup = new Group("Sky", GroupType.ReferenceFrame, null);

                LayerMap_Accessor selectedLayerMap = new LayerMap_Accessor(namedRange);
                selectedLayerMap.MapType = LayerMapType.LocalInWWT;
                selectedLayerMap.LayerDetails.Group = skyGroup;
                selectedLayerMap.LayerDetails.ID = "sunLayerID1";

                WorkflowController_Accessor.GotoViewpointOnViewInWWT(selectedLayerMap);
            }
            finally
            {
                application.Close();
                if (createdWtmlKey)
                {
                    // Delete the registry key if it is created by this test case.
                    Registry.ClassesRoot.DeleteSubKey(@".wtml", false);
                }
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:33,代码来源:WorkflowControllerTest.cs

示例10: UpdateHeaderTest

        public void UpdateHeaderTest()
        {
            Application application = new Application();

            try
            {
                Workbook book = application.OpenWorkbook("TestData.xlsx", false);
                WorkflowController_Accessor target = GetWorkflowControllerAccessor(application);
                target.currentWorkbookMap = new WorkbookMap_Accessor(book);

                Common.Globals_Accessor.wwtManager = new WWTManager(new WWTMockRequest());
                Common.Globals_Accessor.TargetMachine = new TargetMachine("localhost");

                // Get the named range stored in the test data excel file.
                Name name = book.Names.GetNamedRange("ColumnList");

                LayerMap_Accessor wwtLayerMap = new LayerMap_Accessor(name);
                wwtLayerMap.LayerDetails.Name = "Layer";
                wwtLayerMap.LayerDetails.ID = "754becad-8e2c-4452-b7e9-55827d4d2786";
                wwtLayerMap.MapType = LayerMapType.WWT;

                WorkflowController_Accessor.UpdateHeader(wwtLayerMap);

                // It is expected to be in synch
                Assert.IsFalse(wwtLayerMap.IsNotInSync);

                Common.Globals_Accessor.wwtManager = new WWTManager(new WWTInvalidMockRequest());
                Common.Globals_Accessor.TargetMachine = new TargetMachine("localhost");

                WorkflowController_Accessor.UpdateHeader(wwtLayerMap);

                // It is expected not to be in synch
                Assert.IsTrue(wwtLayerMap.IsNotInSync);

                LayerMap_Accessor localLayerMap = new LayerMap_Accessor(name);
                localLayerMap.LayerDetails.Name = "Layer";
                localLayerMap.LayerDetails.ID = "754becad-8e2c-4452-b7e9-55827d4d2786";
                localLayerMap.MapType = LayerMapType.Local;
                localLayerMap.IsNotInSync = true;

                WorkflowController_Accessor.UpdateHeader(localLayerMap);

                // It is expected not to be in synch
                Assert.IsTrue(localLayerMap.IsNotInSync);
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:50,代码来源:WorkflowControllerTest.cs

示例11: SetLayerDetailsViewModelPropertiesTest

        public void SetLayerDetailsViewModelPropertiesTest()
        {
            Application application = new Application();
            try
            {
                Workbook book = application.OpenWorkbook("TestData.xlsx", false);

                Name namedRange = book.Names.GetNamedRange("ColumnList");

                Common.Globals_Accessor.wwtManager = new WWTManager(new WWTMockRequest());
                Common.Globals_Accessor.TargetMachine = new TargetMachine("localhost");

                LayerMap_Accessor localLayerMap = new LayerMap_Accessor(namedRange);
                localLayerMap.LayerDetails.Name = "Layer";
                localLayerMap.MapType = LayerMapType.LocalInWWT;

                LayerMap currentLayer = new LayerMap(namedRange);
                currentLayer.LayerDetails.Name = "Layer";
                currentLayer.MapType = LayerMapType.Local;

                WorkflowController_Accessor target = GetWorkflowControllerAccessor(application);

                target.currentWorkbookMap = new WorkbookMap_Accessor(book);
                target.layerDetailsViewModel = new LayerDetailsViewModel();
                target.layerDetailsViewModel.Currentlayer = currentLayer;
                target.currentWorkbookMap.SelectedLayerMap = localLayerMap;

                string expected = "Layer (not linked)";
                target.SetLayerDetailsViewModelProperties();

                Assert.AreEqual(expected, target.layerDetailsViewModel.SelectedLayerText);
                Assert.AreEqual(false, target.layerDetailsViewModel.IsViewInWWTEnabled);
                Assert.AreEqual(false, target.layerDetailsViewModel.IsCallOutVisible);
                Assert.AreEqual(true, target.layerDetailsViewModel.IsGetLayerDataEnabled);
                Assert.AreEqual(true, target.layerDetailsViewModel.IsReferenceGroupEnabled);
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:41,代码来源:WorkflowControllerTest.cs

示例12: IsValidFalseTest

        public void IsValidFalseTest()
        {
            Application application = new Application();

            try
            {
                Workbook book = application.OpenWorkbook("WorkbookTestData.xlsx", false);
                Name namedRange = book.Names.GetNamedRange("NonExistingRange");
                bool expected = false;
                bool actual = namedRange.IsValid();
                Assert.AreEqual(expected, actual);
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:17,代码来源:NameExtensionsTest.cs

示例13: CreateLayerInWWTTest

        public void CreateLayerInWWTTest()
        {
            Application application = new Application();

            try
            {
                Workbook book = application.OpenWorkbook("TestData.xlsx", false);

                WorkflowController_Accessor target = GetWorkflowControllerAccessor(application);
                target.currentWorkbookMap = new WorkbookMap_Accessor(book);

                Common.Globals_Accessor.wwtManager = new WWTManager(new WWTMockRequest());
                Common.Globals_Accessor.TargetMachine = new TargetMachine("localhost");

                // Get the named range stored in the test data excel file.
                Name name = book.Names.GetNamedRange("ColumnList");
                Group parentGroup = new Group("Sun", GroupType.ReferenceFrame, null);
                Group childGroup = new Group("Earth", GroupType.LayerGroup, parentGroup);

                string oldLayerId = "754becad-8e2c-4452-b7e9-55827d4d2786";

                LayerMap_Accessor localLayerMap = new LayerMap_Accessor(name);
                localLayerMap.LayerDetails.Name = "Layer";
                localLayerMap.LayerDetails.ID = oldLayerId;
                localLayerMap.LayerDetails.Group = childGroup;
                localLayerMap.MapType = LayerMapType.Local;
                localLayerMap.HeaderRowData = new System.Collections.ObjectModel.Collection<string>();
                localLayerMap.HeaderRowData.Add("LAT");
                localLayerMap.HeaderRowData.Add("Long");
                localLayerMap.HeaderRowData.Add("Time");

                bool expected = true;

                string layerId = "2cf4374f-e1ce-47a9-b08c-31079765ddcf";
                bool actual = WorkflowController_Accessor.CreateLayerInWWT(localLayerMap);
                Assert.AreEqual(expected, actual);
                Assert.AreEqual(LayerMapType.LocalInWWT, localLayerMap.MapType);
                Assert.AreEqual(layerId, localLayerMap.LayerDetails.ID);

                localLayerMap.LayerDetails.ID = oldLayerId;
                Group invalidGroup = new Group("Test", GroupType.LayerGroup, parentGroup);
                localLayerMap.LayerDetails.Group = invalidGroup;
                actual = WorkflowController_Accessor.CreateLayerInWWT(localLayerMap);
                Assert.AreEqual(expected, actual);
                Assert.AreEqual(LayerMapType.LocalInWWT, localLayerMap.MapType);
                Assert.AreEqual(layerId, localLayerMap.LayerDetails.ID);
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:52,代码来源:WorkflowControllerTest.cs

示例14: DeleteMappingTest

        public void DeleteMappingTest()
        {
            Application application = new Application();

            try
            {
                Workbook book = application.OpenWorkbook("TestData.xlsx", false);
                WorkflowController_Accessor target = GetWorkflowControllerAccessor(application);
                target.currentWorkbookMap = new WorkbookMap_Accessor(book);
                Worksheet worksheet = application.ActiveSheet;
                Range address = worksheet.get_Range("A1:G8");
                Name namedRange = book.CreateNamedRange("DeleteMappingRange", address);
                LayerMap_Accessor localLayer = new LayerMap_Accessor(namedRange);
                target.currentWorkbookMap.SelectedLayerMap = localLayer;
                target.DeleteMapping();
                Assert.IsNull(book.Names.GetNamedRange("DeleteMappingRange"));
                Assert.IsNull(target.currentWorkbookMap.SelectedLayerMap);
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:23,代码来源:WorkflowControllerTest.cs

示例15: GetActiveWorksheetTest

        public void GetActiveWorksheetTest()
        {
            Application application = new Application();

            try
            {
                Workbook book = application.OpenWorkbook("TestData.xlsx", false);

                ThisAddIn_Accessor.ExcelApplication = application;

                book.Sheets[3].Activate();

                // Active sheet returned will be the book.Sheets[3] object.
                _Worksheet activeSheet = WorkflowController_Accessor.GetActiveWorksheet();
                Assert.AreEqual(activeSheet, book.Sheets[3]);
            }
            finally
            {
                application.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:21,代码来源:WorkflowControllerTest.cs


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