Returns a reference to an item in an array
CXlCell Cell( size_t szRow, size_t szCol ); const CXlConstCell Cell( size_t szRow, size_t szCol ) const; |
The row containing the item of interest (the top row is 0).
The column containing the item of interest (the leftmost column is 0).
The reference returned by this function can be used to read the item and (if the CXlOper itself is writeable) to update it.
If the indices are out of range then an exception of type CXlOutOfRangeException will be thrown.
Under previous versions of XLL+ (5 and below), this method returned a reference to a CXlOper type, which was contained within the outer CXlOper. In order to support both Excel 2007 and older versions of Excel, this functionality has had to be changed.
The method now returns a new class of object, CXlCell or CXlConstCell, which can be used to refer to the cell, but is not itself of type CXlOper.
If your code retained a copy of the return value, as in for instance:
const CXlOper& item = xloArray.Cell(i, j); total += item.ToDouble();
then it must be changed. The code above becomes:
CXlConstCell item = xloArray.Cell(i, j); total += item.ToDouble();
If your code simply used the returned value without retaining a copy of it, then it will continue to compile. For example, the following code does not need to change:
xloArray.Cell(i, j) = 0.0;
CXlOper::GetCallerDims() Example | CXlOper::Cell() Example | CXlOper::AllocArray() Example | CXlOper::GetCaller() Example | MyMonthsInYear Example | MySum Example
Header: xllplus.h