2.2.4.46.96 Worksheet::Worksheet

Description

Construct a worksheet object and attach to named worksheet window


Construct a worksheet object and attach to the given layer

Syntax

Worksheet( LPCTSTR lpcszWksName )


Worksheet( Layer & layer )

Parameters

lpcszWksName
[input] The name of an Origin worksheet object. String format is "[BookName]SheetName", like "[Book1]Sheet1".


layer
[input] A layer object

Return

Examples

EX1

// Determine if there is a worksheet named Sheet1 in Book1
int Worksheet_Worksheet_Ex2(string strSheetName = "[Book1]Sheet1")
{
    Worksheet wks(strSheetName);
    if(!wks)
    {
        out_str("There is no such worksheet");
        return 1;
    }
    else
        out_str("Found worksheet " + strSheetName);
    return 0;
}


EX2

// Report the number of columns in the active worksheet
int Worksheet_Worksheet_Ex3()
{
    Worksheet wks(Project.ActiveLayer());
    if(!wks)
    {
        out_str("The active layer is not a worksheet, or there is nothing in the project");
        return 1;
    }
    else
    {
        printf("Worksheet %s has %d columns\n",wks.GetPage().GetName(),wks.GetNumCols());
        return 0;
    }
}

Remark

Worksheet is one of the wrapper objects that is a reference to the actual internal Origin object.

You can construct a new Worksheet object from another layer object. The worksheet will become invalid if

the layer to construct with is actually not a worksheet

See Also

Header to Include

origin.h