XLL+ Class Library (6.3)

CXlOper::FromVector2

Assigns a 1-dimensional array of numbers, booleans or strings to the CXlOper

template< class T >
const CXlOper& FromVector2(
   const std::vector<T>& dvec,
   bool bRow = FALSE,
   size_t lLBound = 0,
   bool toBoolean = FALSE
);

Parameters

dvec

1-dimensional array of data.

The following types for T are directly supported:

  • bool
  • long
  • unsigned long
  • int
  • unsigned int
  • short
  • unsigned short
  • double
  • float
  • CString
  • CStringA
  • CStringW
  • std::string
  • std::wstring
Any other type is treated as an enumerated type, and converted first to long and then to a number.

bRow

If true, then the vector created will be a row; otherwise the vector will be a column.

lLBound

The lower bound of "interesting" inputs. The first lLBound items in the input vector will be ignored.

toBoolean

If true, then the resulting Excel array will contain boolean values instead of numbers. (If T is a string, then all values will be false.)

Remarks

This function sets the type of the CXlOper to be an array with a single column or row, allocates space for the vector of doubles, booleans or strings provided and sets the values into the CXlOper.

This function is called by the CXlOper(std::vector<...> vec) constructors.

Note that integer numeric types are returned to Excel as boolean values. To return integer types as numbers, use CXlOper::FromNumericVector2().

The method will throw an exception of type CXlEmptyArrayException if the supplied array is empty, or of type CXlArrayTooLargeException if the array is too large.

Example

CXlOper::FromVector2() Example

Requirements

Header: xllplus.h

See Also

CXlOper Class | CXlOper Methods | CXlOper::operator = | CXlOper::CXlOper | CXlOper::FromNumericVector2