XLL+ Class Library (6.3)

CXlOper::Cell() Example

CopyC++
//{{XLP_SRC(OperCellExample) 
    // NOTE - the FunctionWizard will add and remove mapping code here. 
    //    DO NOT EDIT what you see in these blocks of generated code!
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)
{
    // End of generated code 
//}}XLP_SRC

    BOOL bOk = TRUE;

    // Check that we are inspecting an array
    bOk = Arg1->IsArray();

    // Check that the zero-based row and column 
    // indices are in range
    bOk = bOk && (Row >= 0) && (Column >= 0);
    bOk = bOk && (Row < Arg1->GetHeight()) 
              && (Column < Arg1->GetWidth());

    // Extract the one interesting cell 
    if ( bOk )
        xloResult = Arg1->Cell(Row, Column);
    else
        xloResult = xlerrNA;

    return xloResult.Ret();
}

Uses

CXlOper::Cell | CXlOper::IsArray