Hi,
When I recover the Range value in a Excel sheet Range("B6:E8") using comDispInterface::getProperty, I obtein a comDomains::safeArray variant.
How to convert it in string_list (or integer_list) ?
-
- VIP Member
- Posts: 1466
- Joined: 28 Feb 2000 0:01
Re: How to convert a safeArray ?
There are classes: safeArrayBstr and safeArrayInteger. With constructors newCopy that takes a nativeSafeArray as argument. They will raise an exception if the type does not match.
On such an object, you can call getBoundaries to obtain a description of the indices and their range.
And then you can obtain individual elements using getValue (and set them using setValue).
Notice that you are responsible for destroying the array:
I believe you have to use the first since you must destroy both the descriptor and the data.
On such an object, you can call getBoundaries to obtain a description of the indices and their range.
And then you can obtain individual elements using getValue (and set them using setValue).
Notice that you are responsible for destroying the array:
Code: Select all
predicates
safeArrayDestroy : (comDomains::nativeSafeArray SafeArray).
% @short See SafeArrayDestroy in MSDN
% @end
predicates
safeArrayDestroyData : (comDomains::nativeSafeArray SafeArray).
% @short
% @short See SafeArrayDestroyData in MSDN
% @end
predicates
safeArrayDestroyDescriptor : (comDomains::nativeSafeArray SafeArray).
% @short See SafeArrayDestroyDescriptor in MSDN
% @end
Regards Thomas Linder Puls
PDC
PDC
-
- VIP Member
- Posts: 204
- Joined: 16 Oct 2001 23:01
Re: How to convert a safeArray ?
Thanks for your help.
My code work fine now : 
My code work fine now :
Code: Select all
% with Selection = "D4:F6"
Values == Selection:getProperty("Value"),
if Values = comDomains::safeArray(SA) then
Array = safeArrayVariant::newCopy(SA),
Nb_array = Array:getBoundaries(), % [boundary(2,1),boundary(2,1)]
Prem = Array:getValue([3,3]), % return cell F6 value
_R_sa_destroy = safeArray_native::safeArrayDestroy(SA)
end if,
