XLL+ Class Library (6.3)

::XlReadVector

Transform all or part of a CXlOper into a vector

template< class T >
void XlReadVector(
   const CXlOper& xlo,
   std::vector<T>& value,
   CVectorConvertParams<T>& params
);
template< class T >
void XlReadVector(
   const CXlOper& xlo,
   std::vector<T>& value,
   const wchar_t* argName,
   unsigned long flags = 0,
   long* expectedSize = NULL,
   unsigned long lowerBound = 0,
   const T& defaultCellValue = T()
);

Parameters

xlo

A reference to the input passed by Excel.

value

A reference to a variable into which the results will placed, if the conversion is successful.

params

A set of parameters that control the conversion.

See CVectorConvertParams<T> for details.
argName

The name of the argument that is being converted. This will be used in error messages.

flags

A set of flags that control the conversion. See Conversion functions for a list of values.

expectedSize

A pointer to variable that will receive the size of the vector. If it has already been set (i.e. does not have a value of -1), and the size of the vector is not equal to the value. then an exception of type CXlConversionException will be thrown, along with a user-friendly message, such as "Expected 15 items in X". If the pointer is NULL, then the argument will be ignored.

lowerBound

The number of empty items to insert at the start of the result vector. If you are going to pass the vector to a library function that expects vectors to be 1-based, then this value should be set to 1.

defaultCellValue

The default value that will be used for empty cells, if the appropriate flags have been set for the conversion.

Remarks

If the function fails for any reason, an exception of type CXlConversionException is thrown. This will be caught by the outer wrapper function, and converted into an appropriate form to be returned to Excel.

Requirements

Header: xlpconvert.h

See Also

Global conversion functions