CopyC++
IMPLEMENT_XLLFN3(OperCellExample, OperCellExample_4, OperCellExample_12, "RPHH",
"UQHH", L"OperCellExample", 0, L"Arg1,Row,Column", 0, L"Example", 0, L"Dem"
L"onstrates COper::Cell", 0, L"Argument 1\0Row of cell to extract\0Column "
L"of cell to extract\0", 0, 0, L"{OperCellExample,,,Demonstrates COper::Ce"
L"ll,Example,1,128,U,{{0,{Arg1,Value,0,,Argument 1,,,,}},{0,{Row,Unsigned "
L"Short Int,0,,Row of cell to extract,,,,}},{0,{Column,Unsigned Short Int,"
L"0,,Column of cell to extract,,,,}}},{},3,,0,0}", 1)
CXlOper* OperCellExample_Impl(CXlOper&, const CXlOper*, unsigned short int,
unsigned short int);
extern "C" __declspec(dllexport)
LPXLOPER12 OperCellExample_12(LPXLOPER12 Arg1, unsigned short int Row, unsigned
short int Column)
{
XLL_FIX_STATE;
CXlOper xloResult, Arg1__port(Arg1);
try {
CXlStructuredExceptionHandler _seh_;
xloResult.HandleResult(OperCellExample_Impl(xloResult, &Arg1__port, Row,
Column));
}
catch(const CXlRuntimeException& ex) {
CXllApp::Instance()->DisplayException(xloResult, ex);
}
return xloResult.Ret12();
}
extern "C" __declspec(dllexport)
LPXLOPER4 OperCellExample_4(LPXLOPER4 Arg1, unsigned short int Row, unsigned
short int Column)
{
XLL_FIX_STATE;
CXlOper xloResult, Arg1__port(Arg1);
try {
CXlStructuredExceptionHandler _seh_;
xloResult.HandleResult(OperCellExample_Impl(xloResult, &Arg1__port, Row,
Column));
}
catch(const CXlRuntimeException& ex) {
CXllApp::Instance()->DisplayException(xloResult, ex);
}
return xloResult.Ret4();
}
CXlOper* OperCellExample_Impl(CXlOper& xloResult, const CXlOper* Arg1, unsigned
short int Row, unsigned short int Column)
{
BOOL bOk = TRUE;
bOk = Arg1->IsArray();
bOk = bOk && (Row >= 0) && (Column >= 0);
bOk = bOk && (Row < Arg1->GetHeight())
&& (Column < Arg1->GetWidth());
if ( bOk )
xloResult = Arg1->Cell(Row, Column);
else
xloResult = xlerrNA;
return xloResult.Ret();
}
Uses
CXlOper::Cell | CXlOper::IsArray