CopyC++
IMPLEMENT_XLLFN3(AllocArrayEx, AllocArrayEx_4, AllocArrayEx_12, "R", "U", L"Al"
L"locArrayEx", 0, L"", 0, L"Demo functions", 0, L"Returns a mixed array of"
L" data", 0, L"", 0, 0, L"{AllocArrayEx,,,Returns a mixed array of data,De"
L"mo functions,1,128,U,{},{},3,,0,0}", 1)
CXlOper* AllocArrayEx_Impl(CXlOper&);
extern "C" __declspec(dllexport)
LPXLOPER12 AllocArrayEx_12()
{
XLL_FIX_STATE;
CXlOper xloResult;
try {
CXlStructuredExceptionHandler _seh_;
xloResult.HandleResult(AllocArrayEx_Impl(xloResult));
}
catch(const CXlRuntimeException& ex) {
CXllApp::Instance()->DisplayException(xloResult, ex);
}
return xloResult.Ret12();
}
extern "C" __declspec(dllexport)
LPXLOPER4 AllocArrayEx_4()
{
XLL_FIX_STATE;
CXlOper xloResult;
try {
CXlStructuredExceptionHandler _seh_;
xloResult.HandleResult(AllocArrayEx_Impl(xloResult));
}
catch(const CXlRuntimeException& ex) {
CXllApp::Instance()->DisplayException(xloResult, ex);
}
return xloResult.Ret4();
}
CXlOper* AllocArrayEx_Impl(CXlOper& xloResult)
{
USHORT cRows = 3, cCols = 2;
xloResult.AllocArray(cRows, cCols);
for (USHORT i = 0; i < cRows; i++) {
xloResult.Cell(i, 0) = (double)i;
CString strFormat;
strFormat.Format("String %d", i);
xloResult.Cell(i, 1) = strFormat;
}
return xloResult.Ret();
}
Uses
CXlOper::AllocArray | CXlOper::Format | CXlOper::Cell