2.2.4.5.19 Column::GetLabel

Description

Get the column LongName by reference.


Get the column LongName.

Syntax

int GetLabel( string & strLabel )


string GetLabel( )

Parameters

strLabel
[output] reference to the string that will receive the label.

Return

The length of the label, 0 if none, -1 if error.


The column label.

Examples

EX1

// Worksheet with at least one column must exist in the project
void    Column_GetLabel_Ex1()
{
    WorksheetPage wp = Project.WorksheetPages(0);
    if(!wp)
        return;
    
    Worksheet wks(wp.GetName());
    string strLabel;
    int i = wks.Columns(0).GetLabel(strLabel);
    printf("Column label for %s is %s\n", wks.Columns(0).GetName(), strLabel);
}


EX2

// Worksheet with at least one column must exist in the project
void    Column_GetLabel_Ex2()
{
    WorksheetPage wp = Project.WorksheetPages(0);
    if(!wp)
        return;
    
    Worksheet wks(wp.GetName());
    string str = wks.Columns(0).GetLabel();
    if(str.IsEmpty())
        printf("Column %s does not have a label\n", wks.Columns(0).GetName());
    else
        printf("Column %s has label %s\n", wks.Columns(0).GetName(), str);
}

Remark

GetLabel function is rarely used nowadays. It was replaced by GetLongName, GetUnits and GetComments.

See Also

Column::SetLabel, Column::GetLongName, Column::GetUnits, Column::GetComments

Header to Include

origin.h