wks_insert_column

 

Description

It appends or inserts a column to worksheet at a desired position.

Syntax

int wks_insert_column( Worksheet & wks, int nDesiredColumnPosition, Column & col )

Parameters

wks
[input] the worksheet to add the column
nDesiredColumnPosition
[input] the desired column position (0 offset). If less than 0, the column
will be appended. If >= 0, but the current total number of columns is
less than nDesiredColumnPosition, the column will also be appended.
col
[output] the added column

Return

the actual index of the added column, which can be different from nDesiredColumnPosition even if nDesiredColumnPosition >= 0.

Examples

EX1

void wks_insert_column_ex1()
{
    Worksheet wks;
    wks.Create();
    int nDesiredColumnPosition =0;
    //note: not set size
    Dataset ds(wks.Columns(0));
    ds = 0;
    
    ds.Attach(wks.Columns(1));
    ds = 1;
    
    //Will insert column to first column.
    Column col;
    int nRet = wks_insert_column(wks, nDesiredColumnPosition, col);
    if(nRet != nDesiredColumnPosition || !col)
        out_str("wrong place of new column");        
}

Remark

See Also

header to Include

origin.h

Reference