find_user_defined_label

 

Description

To find the user defined label by name in Worksheet.

Syntax

int find_user_defined_label(Worksheet& wks, LPCSTR lpcszLabelName)

Parameters

wks
[input] the Worksheet object.
lpcszLabelName
[input] the name of label.

Return

Returns label type RCLT_* value or -1 if not found. See label type define in oc_const.h file ROWCOLLABELTYPE enum.

Examples

EX1

void find_user_defined_label_ex1()
{
        Worksheet wks = Project.ActiveLayer();
        if ( !wks )
                return;
        // find the label named Threshold
        int nLabelType = find_user_defined_label(wks, "Threshold");
        if ( nLabelType < 0 )
                return;
        Grid gg;
        gg.Attach(wks);
        
        vector vv;
        vector<string> vsLabels;
        // get the label contents to a string array
        if( gg.GetLabelsByType(vsLabels, nLabelType) )
        {
                // convert string array to double array
                convert_str_vector_to_num_vector(vsLabels, vv);
                printf("Size=%d, First Value=%f\n", vv.GetSize(), vv[0]);
        }
}

Remark

See Also

Grid::GetLabelsByType, convert_str_vector_to_num_vector

Header to Include

origin.h

Reference