本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}