示例#1
0
        public void Ranges1()
        {
            var       wb     = new XLWorkbook();
            IXLRanges ranges = wb.Ranges("ABC");

            Assert.IsNotNull(ranges);
            Assert.AreEqual(0, ranges.Count());
        }
 private static void AreMergedRangesEquals(IXLRanges expected, IXLRanges actual)
 {
     Assert.AreEqual(expected.Count(), actual.Count(), "Worksheet merged ranges count failed");
     IXLRange[] expectedArray = expected
                                .OrderBy(r => r.RangeAddress.FirstAddress.RowNumber)
                                .ThenBy(r => r.RangeAddress.FirstAddress.ColumnNumber)
                                .ToArray();
     IXLRange[] actualArray = actual
                              .OrderBy(r => r.RangeAddress.FirstAddress.RowNumber)
                              .ThenBy(r => r.RangeAddress.FirstAddress.ColumnNumber)
                              .ToArray();
     for (int i = 0; i < expectedArray.Length; i++)
     {
         Assert.AreEqual(expectedArray[i].RangeAddress.FirstAddress.RowNumber, actualArray[i].RangeAddress.FirstAddress.RowNumber, "Merge range first address row number failed");
         Assert.AreEqual(expectedArray[i].RangeAddress.FirstAddress.ColumnNumber, actualArray[i].RangeAddress.FirstAddress.ColumnNumber, "Merge range first address column number failed");
         Assert.AreEqual(expectedArray[i].RangeAddress.LastAddress.RowNumber, actualArray[i].RangeAddress.LastAddress.RowNumber, "Merge range last address row number failed");
         Assert.AreEqual(expectedArray[i].RangeAddress.LastAddress.ColumnNumber, actualArray[i].RangeAddress.LastAddress.ColumnNumber, "Merge range last address column number failed");
     }
 }