2.2.4.46.74 Worksheet::SetCells

Description

Remarks put a group of values into a row in worksheet

Syntax

BOOL SetCells( const vector<string> & vsValues, int nRow = -1, int nC1 = 0, BOOL bConsiderNumeric = true, DWORD dwCtrl = 0 )
BOOL SetCells( const vector& vdValues, int nRow = -1, int nC1 = 0, DWORD dwCtrl = 0 );

Parameters

vsValues
[input] values to set, any string that can be converted to numeric will be converted and set as numeric
nRow
[input] -1 to append to last row for column nC1
nC1
[input] starting column index to set the row of values
bConsiderNumeric
[input] when true, check lpcszText and set as numeric including "--" to become numeric missing value
dwCtrl
[input] see WKSSETCELLSCTRL enum
WKSSETCELLS_UNDO : undo
WKSSETCELLS_BY_COL: set cell values into a column instead of a row
WKSSETCELLS_TREAT_DASH_AS_TEXT : - and -- will be considered as text



vdValues
[input] values to set
nRow
[input] -1 to append to last row for column nC1
nC1
[input] starting column index to set the row of values
dwCtrl
[input] see WKSSETCELLSCTRL enum

Return

TRUE for success, otherwise return false.

Examples

EX1

//Remarks put a group of values into a row in worksheet. 
void Worksheet_SetCells_Ex1()
{
    WorksheetPage wp = Project.WorksheetPages(0);
    if(!wp)
        return;
    
    Worksheet wks(wp.GetName());
    
    vector<string> vsValues;
    for(int ii = 0; ii < 10; ii++)
    {
        vsValues.Add(ftoa(ii));
    }
    
    if( wks.SetCells(vsValues) )
        printf("Success to set worksheet cell values!");
    else
        printf("Fail to set cell values!");
}

EX2

void wks_SetCells_lastrow()
{
    Worksheet wks = Project.ActiveLayer();
    if(!wks)
    	return;
    
    int nRow = -1;
    int nCol = 0;
    
    DWORD dwCtrl = 0;
    
    vector vdValues = {0.0, 1.2, NANUM, 4};
    wks.SetCells(vdValues, nRow, nCol, dwCtrl);
}

Remark

See Also

Datasheet::SetCell

Header to Include

origin.h