Class RangeCollection

RangeCollection class

Encapsulates a collection of Range objects.

public class RangeCollection : CollectionBase<Range>

Properties

NameDescription
Capacity { get; set; }
Count { get; }
Item { get; }Gets the Range element at the specified index.
Item { get; set; }

Methods

NameDescription
Add(Range)Adds a Range item to the collection.
BinarySearch(Range)
BinarySearch(Range, IComparer<Range>)
BinarySearch(int, int, Range, IComparer<Range>)
Clear()
Contains(Range)
CopyTo(Range[])
CopyTo(Range[], int)
CopyTo(int, Range[], int, int)
Exists(Predicate<Range>)
Find(Predicate<Range>)
FindAll(Predicate<Range>)
FindIndex(Predicate<Range>)
FindIndex(int, Predicate<Range>)
FindIndex(int, int, Predicate<Range>)
FindLast(Predicate<Range>)
FindLastIndex(Predicate<Range>)
FindLastIndex(int, Predicate<Range>)
FindLastIndex(int, int, Predicate<Range>)
GetEnumerator()
IndexOf(Range)
IndexOf(Range, int)
IndexOf(Range, int, int)
LastIndexOf(Range)
LastIndexOf(Range, int)
LastIndexOf(Range, int, int)
RemoveAt(int)

Examples

// Called: public static void equals(RangeCollection arrRangeSrc, RangeCollection arrRangeDest, string info)
public static void Type_RangeCollection(RangeCollection arrRangeSrc, RangeCollection arrRangeDest, string info)
        {
            if (AssertHelper.checkNull(arrRangeSrc, arrRangeDest, info))
            {
                return;
            }
            int countSrc = arrRangeSrc.Count;
            int countDest = arrRangeDest.Count;
            AssertHelper.AreEqual(countSrc, countDest, info + ".Count");         

            for (int i = 0; i < countSrc; i++)
            {
                Aspose.Cells.Range rangeSrc = arrRangeSrc[i];
                bool IsSame = false;
                for (int j = 0; j < countDest; j++)
                {
                    IsSame = false;
                    Aspose.Cells.Range rangeDest = arrRangeDest[j];
                    if (rangeSrc.FirstRow == rangeDest.FirstRow && rangeSrc.FirstColumn == rangeDest.FirstColumn &&
                        rangeSrc.RowCount == rangeDest.RowCount && rangeSrc.ColumnCount == rangeDest.ColumnCount)
                    {
                        Type_RangeCollection(rangeSrc, rangeDest, info + ".Range" + "[" + i +"]");
                        IsSame = true;
                        break;
                    }
                }
                if (!IsSame)
                {
                    AssertHelper.Fail("Ranges isn't same!");
                }
            }


        }

See Also