GetAs1DArray
Return a copy of a vector or Dataset as a one dimensional array of type _VARIANT.
_VARIANT GetAs1DArray( )
Returns a one dimensional array of type _VARIANT containg a copy of the data in a vector.
EX1
void vectorbase_GetAs1DArray_ex1() { Worksheet wks = Project.ActiveLayer(); if( wks ) { Dataset aa(wks,0); _VARIANT varData; varData = aa.GetAs1DArray(); } }
When 1-dimensional objects such a vector or a Dataset is assigned to a COM object of type _VARIANT, a 2-dimensional array is created where the second dimension is set to 1. This is because applications such as Excel expect a 2-dimensional object such as when assigning a _VARIANT to a range object.
However, some COM objects require 1-dimensional arrays of type _VARIANT. This function returns a 1-dimensional array from a vector or a Dataset. _VARIANT is a universal type that exists in COM to hold various types of data. It is used to get the values of properties of COM objects. It can represent individual values of int, double, etc., as well as arrays and other composite types.
vectorbase::GetDataAsOneDimensionalArray, vectorbase::GetAs2DArray
origin.h