XLL+ Class Library (7.0)

CXlArrayRowIterator<T> Class

Iterates over the rows of CXlOper instances that contain arrays.

class CXlArrayRowIterator<T>

Overview

The CXlArrayRowIterator<T> class is a utility class to help you iterate across CXlOper instances that contain large arrays. The iterator traverses across each row of the array, starting at the top row and moving to the bottom row.

The class is normally accessed through a typedef of the container class: CXlArrayContainer<T>::row_iterator.

These iterators can be used to iterate through a CXlOper containing an array with minimum performance overhead. Compared with standard CXlOper programming, using these classes is harder work.

Usage

Use the class with the following pattern:

	
    double total = 0.0;
    if (input->HasOper12())
    {
        CXlArrayContainer<XLOPER12> cont(*input);
        for (CXlArrayContainer<XLOPER12>::row_iterator r = cont.begin_rows(); r != cont.end_rows(); r++)
        {
            // Look at a cell in the first column of the current row
            if (r->xltype == xltypeNum)
                total += r->val.num;
            // Look at a cell in the third column of the current row
            if (r[2].xltype == xltypeNum)
                total += r[2].val.num;
        }
    }
    else if (input->HasOper4())
    {
        // Provide this section only if you wish to provide support for Excel 2003 and below
        CXlArrayContainer<XLOPER4> cont(*input);
        // ...
    }

	

Requirements

Header: xlpfastit.h

See Also

CXlArrayRowIterator<T> Methods | xlpfastit.h | CXlArrayContainer<T> class | CXlArrayCellIterator<T> class | CXlArrayColumnIterator<T> class