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


C# Application.Union方法代码示例

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


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

示例1: GetDataArrayInvalidRangeTest

        public void GetDataArrayInvalidRangeTest()
        {
            InteropExcel.Application excelApp = new InteropExcel.Application();

            try
            {
                excelApp.Workbooks.Add();
                InteropExcel.Worksheet worksheet = excelApp.ActiveSheet;

                Range range = worksheet.get_Range("A1", "I7");
                Range test = worksheet.get_Range("B10", "J15");
                Range mergedRange = excelApp.Union(range, test);

                object[,] expected = null;
                object[,] actual = mergedRange.GetDataArray(false);
                Assert.AreEqual(expected, actual);
            }
            finally
            {
                excelApp.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:22,代码来源:RangeExtensionsTest.cs

示例2: IsValidTwoAreasPositiveTest

        public void IsValidTwoAreasPositiveTest()
        {
            InteropExcel.Application excelApp = new InteropExcel.Application();

            try
            {
                excelApp.Workbooks.Add();
                InteropExcel.Worksheet worksheet = excelApp.ActiveSheet;

                Range range = worksheet.get_Range("A1", "I7");
                bool expected = true;

                Range test = worksheet.get_Range("A10", "I15");
                Range mergedRange = excelApp.Union(range, test);
                bool actual = mergedRange.IsValid();
                Assert.AreEqual(expected, actual);
            }
            finally
            {
                excelApp.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:22,代码来源:RangeExtensionsTest.cs

示例3: HasChangedInvalidRangeTest

        public void HasChangedInvalidRangeTest()
        {
            InteropExcel.Application excelApp = new InteropExcel.Application();

            try
            {
                excelApp.Workbooks.Add();
                InteropExcel.Worksheet worksheet = excelApp.ActiveSheet;

                Range range = worksheet.get_Range("A1", "I7");
                Range test = worksheet.get_Range("B10", "J15");
                Range mergedRange = excelApp.Union(range, test);

                Range target = worksheet.get_Range("A1", Type.Missing);
                bool expected = false;
                bool actual = mergedRange.HasChanged(target);
                Assert.AreEqual(expected, actual);
            }
            finally
            {
                excelApp.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:23,代码来源:RangeExtensionsTest.cs

示例4: HasChangedIntersectionPositiveSingleAndMultipleAreasTest

        public void HasChangedIntersectionPositiveSingleAndMultipleAreasTest()
        {
            InteropExcel.Application excelApp = new InteropExcel.Application();

            try
            {
                excelApp.Workbooks.Add();
                InteropExcel.Worksheet worksheet = excelApp.ActiveSheet;

                Range areaOne = worksheet.get_Range("A1", "I7");
                Range areaTwo = worksheet.get_Range("A10", "I15");
                Range mergedRange = excelApp.Union(areaOne, areaTwo);
                Range areaThree = worksheet.get_Range("D12", Type.Missing);
                Range mergedWithSingle = excelApp.Union(mergedRange, areaThree);

                Range target = worksheet.get_Range("A11", "I13");
                bool expected = true;
                bool actual = mergedWithSingle.HasChanged(target);
                Assert.AreEqual(expected, actual);
            }
            finally
            {
                excelApp.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:25,代码来源:RangeExtensionsTest.cs

示例5: HasChangedIntersectionNegativeMultipleAreasTest

        public void HasChangedIntersectionNegativeMultipleAreasTest()
        {
            InteropExcel.Application excelApp = new InteropExcel.Application();

            try
            {
                excelApp.Workbooks.Add();
                InteropExcel.Worksheet worksheet = excelApp.ActiveSheet;

                // worksheet names
                Range areaOne = worksheet.get_Range("A1", "I7");
                Range areaTwo = worksheet.get_Range("A10", "I15");
                Range mergedRange = excelApp.Union(areaOne, areaTwo);

                Range target = worksheet.get_Range("A8", "I8");
                bool expected = false;
                bool actual = mergedRange.HasChanged(target);
                Assert.AreEqual(expected, actual);
            }
            finally
            {
                excelApp.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:24,代码来源:RangeExtensionsTest.cs

示例6: GetHeaderInvalidRangeTest

        public void GetHeaderInvalidRangeTest()
        {
            InteropExcel.Application excelApp = new InteropExcel.Application();

            try
            {
                excelApp.Workbooks.Add();
                InteropExcel.Worksheet worksheet = excelApp.ActiveSheet;

                Range range = worksheet.get_Range("A1", "I7");
                Range anotherRange = worksheet.get_Range("B10", "J15");
                Range mergedRange = excelApp.Union(range, anotherRange);
                Collection<string> actual = mergedRange.GetHeader();
                Assert.AreEqual(0, actual.Count);
            }
            finally
            {
                excelApp.Close();
            }
        }
开发者ID:rat-s-tar,项目名称:wwt-excel-plugin,代码行数:20,代码来源:RangeExtensionsTest.cs


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