2.2.4.9.16 DataRange::GetName

Description

Get DataRange name as a string that has been set by SetName.

Syntax

string GetName( )

Parameters

Return

Returns the name of the DataRange

Examples

EX1

//This example will show the name of the Datarange
#include <Range.h>
void DataRange_GetName_Ex1(int nCol1 = 0, int nCol2 = 1)
{
    Worksheet wks ;
    wks.Create();
    if( wks )
    {
        while(wks.Columns(0))
            wks.DeleteCol(0);

        wks.AddCol("A");
        wks.AddCol("B");
        double rr;
        for(int j=0;j<2;j++)
        {
            for (int i=0;i<10;i++)
            {
                   rr=rnd();
                   wks.SetCell(i,j,rr*100);
            }
        }
            
        DataRange dr;
        dr.Add("X", wks, 0, nCol1, -1, nCol1);
        dr.Add("Y", wks, 0, nCol2, -1, nCol2);
        dr.SetName("This is a Long Name for the Range");
        string strName = dr.GetName();
        out_str(strName);
        string strDescription = dr.GetDescription();
    }
}

Remark

See Also

DataRange::SetName

Header to Include

origin.h