XLL+ Class Library (7.0)

CXlArrayColumnIterator<T> Class

Iterates over the columns of CXlOper instances that contain arrays.

class CXlArrayColumnIterator<T>

Overview

The CXlArrayColumnIterator<T> class is a utility class to help you iterate across CXlOper instances that contain large arrays. The iterator traverses across each column of the array, starting at the left-most column and moving to the right-most column.

The class is normally accessed through a typedef of the container class: CXlArrayContainer<T>::col_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>::col_iterator c = cont.begin_cols(); c != cont.end_cols(); c++)
        {
            // Look at a cell in the first row of the current column
            if (c->xltype == xltypeNum)
                total += c->val.num;
            // Look at a cell in the the second row of the current column
            if (c[1].xltype == xltypeNum)
                total += c[1].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

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