Datasheet::Cell

Description

Get the value at the location (nRow, nCol) in the worksheet

Syntax

double Cell( int nRow, int nCol )

Parameters

nRow
[input] Row number with zero offset
nCol
[input] Column number with zero offset

Return

Value at the location (nRow, nCol) in the worksheet

Examples

EX1

//Set and get cell value in the active worksheet.
int Datasheet_Cell_Ex1()
{
    WorksheetPage wp = Project.WorksheetPages(0);
    if(!wp)
        return -1;
    
    Worksheet wks(wp.GetName());
    wks.SetCell(0, 0, 3.14);
    double cellValue = wks.Cell(0, 0);
    printf("Value at (0,0) location is %f\n", cellValue);
    return 0;
}
//Get cell value in the active matrix.
void MatrixLayer_Cell_Ex1()
{
        //make sure there exists active matrixlayer containing multiple matrixobjects and filled with data
        //then active different matrixobject and see the result.
        MatrixLayer ml = Project.ActiveLayer();
        if ( !ml )
        {
                printf("Can not access active matrixsheet");
                return;
        }
        double dVal = ml.Cell(5, 0); //get the active matrixobject's  sixth cell value in the first column
        out_double("The cell value is ", dVal);
}

Remark

See Also

Worksheet::GetCell, Datasheet::SetCell, Datasheet::TCell

Header to Include

origin.h