XLL+ Class Library (7.0)

CXlArrayCellIterator<T> Class

Iterates over each of the cells in CXlOper instances that contain arrays.

class CXlArrayCellIterator<T>

Overview

The CXlArrayCellIterator<T> class is a utility class to help you iterate across CXlOper instances that contain large arrays. The iterator traverses across all cells in the array row-wise, starting at the top row and moving to the bottom row. Within each row it traverses from left to right.

The class is normally accessed through a typedef of the container class: CXlArrayContainer<T>::cell_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>::cell_iterator i = cont.begin(); i != cont.end(); i++)
        {
            // Look at the value in each cell
            if (i->xltype == xltypeNum)
                total += i->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

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