| 2.2.4.46.48 Worksheet::InsertColInsertCol
 DescriptionInsert 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
 Insert column(s) in the worksheet.
 SyntaxBOOL InsertCol( int nPos, LPCSTR lpcszColName, string & strColNameCreated, BOOL bUndo = FALSE ) BOOL InsertCol( int nCount, int nPos = -1, BOOL bUndo = FALSE ) Parameters nPos[input] Column number to insert before (zero offset) lpcszColName[input] String to name inserted column strColNameCreated[output] String to store the col name created bUndo[input] undo
 
  nCount[input] Number of column to insert nPos[input] Column number to insert before (zero offset). -1 means the end bUndo[input] undo
 ReturnTrue for success, otherwise FALSE
 True for success, otherwise FALSE
 ExamplesEX1
 //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;
}EX2
 void Worksheet_InsertCol_Ex2(int nCount = 2, int nPos = -1)
{
	Worksheet wks = Project.ActiveLayer();
	if(!wks)
	{
		out_str("please activate a worksheet");
		return;
	}
	
	if( wks.InsertCol(nCount, nPos, TRUE) )
		out_str("OK");
	else
		out_str("Fail");
}RemarkSee AlsoWorksheet::DeleteCol, Worksheet::InsertRow
 Header to Includeorigin.h
 |