Datasheet::TCell

Description

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

Syntax

string TCell( int nRow, int nCol, int nOption = TCELL_VALUE, DWORD * pdwExtraInfo = NULL )

Parameters

nRow
[input] Row number with zero offset
nCol
[input] Column number with zero offset
nOption
[input] the option whose values are taken from the following enumeration:
enum
{
TCELL_VALUE = 0, // it gets the value as string, formatted according to the column settings if numeric
TCELL_EDIT, // if a link is present in the cell, it retrieves a human-readable string, such as ?$cell=[Book3]Sheet2!B[5]
// otherwise it retrieves the raw string or the numeric value as a string with all decimal digits
TCELL_RAW, // it gets the raw content of the cell or, if numeric, as a string with all decimal digits
};
default is TCELL_VALUE.
pdwExtraInfo
[input] pointer to some bits with cell linking details like GEMSK_CELL_LINK

Return

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

Examples

EX1

//Get the value at the location (nRow, nCol) in the worksheet as a string. 
int Datasheet_TCell_Ex1()
{
    WorksheetPage wp = Project.WorksheetPages(0);
    if(!wp)
        return -1;
    
    Worksheet wks(wp.GetName());
    string strText = "Monday";
    wks.SetCell(0, 0, strText);
    string cellText = wks.TCell(0, 0);
    printf("Value at (0,0) location is %s\n", cellText);
    return 0;
}

EX2

//Get the value at the location (nRow, nCol) in the matrix as a string. 
void MatrixLayer_TCell_Ex1()
{
        MatrixLayer ml = Project.ActiveLayer();
        if ( !ml )
        {
                printf("Can not access active matrixsheet");
                return;
        }
        string strCellText = ml.TCell(0, 0);
        printf("The cell value of Cell(0, 0) is %s\n", strCellText);
        return;
}

Remark

See Also

Datasheet::Cell, Worksheet::GetCell, Datasheet::SetCell

header to Include

origin.h