XLL+ Class Library

COper::ColToVector

Reads a column from an array into a vector of numbers or strings

[C++]
BOOL ColToVector(
   std::vector<double>& dvec,
   CString* psErrorString = 0,
   USHORT usCol = XLA_UNIQUE_VECTOR,
   long lFlags = XLA_ARRAY_FLAGS_STD,
   double dDefault = 0.0,
   USHORT usIgnoreRows = 0
) const;
BOOL ColToVector(
   std::vector<CString>& svec,
   CString* psErrorString = 0,
   USHORT usCol = XLA_UNIQUE_VECTOR,
   long lFlags = XLA_ARRAY_FLAGS_STD,
   const char* pszDefault = "",
   USHORT usIgnoreRows = 0
) const;

Parameters

dvec

A vector of double, whose contents will be replaced by the contents of the OPER array.

psErrorString

Pointer to an error string buffer. If the function fails for any reason, a useful error string will be placed here, e.g. "expected number in cell 3". Ignored if 0.

usCol

Zero-based index of column to be extracted. If it is out of range, the function will fail.

If usCol is set to XLA_UNIQUE_VECTOR, then the only column of a single-column array will be returned: if the array has more than one column, the function will fail and return FALSE.

lFlags

Flags controlling the conversion. See matrix & vector flags for a full list of flag values.

dDefault

Default value to be used when a cell matches the XLA_DEFAULT_ flags provided.

usIgnoreRows

Number of rows at the top of the range to ignore. This can be used to exclude labels from ranges.

svec

A vector of CString, whose contents will be replaced by the contents of the OPER array.

pszDefault

Default value to be used when a cell matches the XLA_DEFAULT_ flags provided.

Return value

The function returns TRUE if the conversion was successful, FALSE if it failed for any reason.

If it fails, an explanatory error string will be written to *psErrorString. This should be returned to the user, along with the name of the argument that failed. See the example for more details.

Remarks

This function extracts a single column of numbers or strings from an array argument. It is reasonably 'smart': by default it truncates any empty cells at the bottom of the input range.

Examples

COper::ColToVector() & RowToVector() Example | MySort Example | MyCorrel Example

Requirements

Header: xllplus.h

See Also

COper Class | COper Methods