XLL+ Class Library (7.0)

ple::clr::toClrObject

Transform an Excel value of unknown type to a CLR object

System::Object^ toClrObject(
   const CXlOperBase& xloValue,
   const wchar_t* argName
);

Parameters

xloValue

A single value received from Excel. This can be a single cell value, or a cell contained in an array value.

Note: if this value is specified as a parameter of the add-in function, it must be of type "Value", and not type "Reference". If the parameter has been passed as type "Reference", then the value must be extracted, using CXlOper::Coerce().

argName

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

Return Value

A CLR object, that may be passed directly to a .NET method, using C++/CLI. If the input cell is empty, then null will be returned.

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: xlpclrconvert.h

See Also

Common Language Runtime support functions | toClr | toClrObjectVector | toClrObjectMatrix