2.2.4.46.47 Worksheet::InsertCol

Description

Insert an empty column in the worksheet with the given name and store the name in a string. If the given name already exists then increment it. The actual name created is returned by reference

Syntax

BOOL InsertCol( int nPos, LPCSTR lpcszColName, string & strColNameCreated, BOOL bUndo = FALSE )

Parameters

nPos
[input] Column number with zero offset
lpcszColName
[input] String to name inserted column
strColNameCreated
[output] String to store the col name created
bUndo
[input] undo

Return

True for success, otherwise FALSE

Examples

EX1

//Output the column name of the inserted column.
int Worksheet_InsertCol_Ex1()
{
    WorksheetPage wp = Project.WorksheetPages(0);
    if(!wp)
        return -1;
    
    Worksheet wks(wp.GetName());
    string strColName = "NewColumn";
    string strColNameCreated;
    BOOL bOK = wks.InsertCol(1, strColName, strColNameCreated); // Insert an empty column at the 1st column ( 0 offset)
    printf("Column Name created is %s\n", strColNameCreated);
    return (int) bOK;
}

Remark

See Also

Worksheet::DeleteCol, Worksheet::InsertRow

Header to Include

origin.h