2.2.4.5.2 Column::Column

Description

Default constructor for Column class


Constructor that creates an Column object when given a column number in a named worksheet.


Constructor that creates a Column object when given a column number and a worksheet object.


Reference copy constructor

Syntax

Column( )


Column( LPCTSTR lpcszWksName, UINT iColNum )


Column( Worksheet & wks, UINT iColNum )


Column( DataObject & colOriginal )

Parameters

lpcszWksName
[input] name of the worksheet.
iColNum
[input] column number in the worksheet.


wks
[input] worksheet object.
iColNum
[input] column number in the worksheet.


colOriginal
[input] column object.

Return

Examples

EX1

// Worksheet with at least one column should exist in project
void Column_Column_Ex1()
{
    Column colMy;
    string strName;
    WorksheetPage wp = Project.WorksheetPages(0);
    if(!wp)
        return;
    colMy.Attach(wp.GetName(), 0);
    if(colMy.IsValid())
    {
        colMy.GetName(strName);
        out_str(strName);
    }            
}


EX2

// Worksheet with at least one column must exist in the project
void Column_Column_Ex2()
{
    WorksheetPage wp = Project.WorksheetPages(0);
    if(!wp)
        return;
    
    Column colMy(wp.GetName(), 0);
    string strName;
    if(colMy.IsValid())
    {
        colMy.GetName(strName);
        out_str(strName);
    }
}

EX3

// Worksheet with at least one column must exist in the project
void Column_Column_Ex3()
{
    Worksheet wks = Project.ActiveLayer();
    if(!wks)
        return;
    
    string strSheetName;
    strSheetName.Format("[%s]%s", wks.GetPage().GetName(), wks.GetName()); 
    
    Column colMy(strSheetName, 0);
    if(colMy.IsValid())
    {
        string strName;
        colMy.GetName(strName);
        out_str(strName);
    }
}


EX4

// Worksheet with at least one column must exist in project
void Column_Column_Ex4()
{
    WorksheetPage wp = Project.WorksheetPages(0);
    if(!wp)
        return;
    
    Worksheet wksMy(wp.GetName());
    Column colMy(wksMy, 0);
    string strName;
    if(colMy.IsValid())
    {
        colMy.GetName(strName);
        out_str(strName);
    }
}


EX5

// Worksheet with at least one column must exist in project
void Column_Column_Ex5()
{
    WorksheetPage wp = Project.WorksheetPages(0);
    if(!wp)
        return;
    
    Column colOriginal(wp.GetName(), 0);
    Column colNew(colOriginal);
    string strName;
    if(colNew.IsValid())
    {
        colNew.GetName(strName);
        printf("Original named %s, reference is also %s\n", colOriginal.GetName(), strName);
    }
}

Remark

Reference copy constructor

Since a Column is a wrapper of the actual internal column inside Origin, you can make copies of this wrapper and both the original and the copy will both be refer to the same internal object.

See Also

Header to Include

origin.h