CopyC++
#include <algorithm>
IMPLEMENT_XLLFN3(XlOperFromVectorEx, XlOperFromVectorEx_4,
XlOperFromVectorEx_12, "RP", "UQ", L"XlOperFromVectorEx", 0, L"Input", 0,
L"Demo Functions", 0, L"Returns a sorted vector", 0, L"Vector of numbers\0",
0, 0, L"{XlOperFromVectorEx,,,Returns a sorted vector,Demo Functions,1,128"
L",U,{{0,{Input,Double,2097162,,Vector of numbers,,{{{0,},{,}}},,}}},{},3,"
L",0,0}", 1)
CXlOper* XlOperFromVectorEx_Impl(CXlOper&, const CXlOper*);
extern "C" __declspec(dllexport)
LPXLOPER12 XlOperFromVectorEx_12(LPXLOPER12 Input)
{
XLL_FIX_STATE;
CXlOper xloResult, Input__port(Input);
try {
CXlStructuredExceptionHandler _seh_;
xloResult.HandleResult(XlOperFromVectorEx_Impl(xloResult, &Input__port));
}
catch(const CXlRuntimeException& ex) {
CXllApp::Instance()->DisplayException(xloResult, ex);
}
return xloResult.Ret12();
}
extern "C" __declspec(dllexport)
LPXLOPER4 XlOperFromVectorEx_4(LPXLOPER4 Input)
{
XLL_FIX_STATE;
CXlOper xloResult, Input__port(Input);
try {
CXlStructuredExceptionHandler _seh_;
xloResult.HandleResult(XlOperFromVectorEx_Impl(xloResult, &Input__port));
}
catch(const CXlRuntimeException& ex) {
CXllApp::Instance()->DisplayException(xloResult, ex);
}
return xloResult.Ret4();
}
CXlOper* XlOperFromVectorEx_Impl(CXlOper& xloResult, const CXlOper* Input)
{
std::vector<double> vecInput;
XlReadVector(*Input, vecInput, L"Input", XLA_TRUNC_ONEMPTY|XLA_TRUNC_ONBLANK
|XLA_BOUND_UBOUND_AUTO, 0, 0);
std::sort(vecInput.begin(), vecInput.end());
xloResult.FromVector2(vecInput);
return xloResult.Ret();
}
Uses
CXlOper::FromVector2