attach_or_create_sheet

 

Description

attach a Worksheet object by [Book]Sheet specification. Create if not found

Syntax

bool attach_or_create_sheet( Datasheet & wks, LPCSTR lpcszBookSheetName, int nCreate = CREATE_HIDDEN, bool bMatrixSheet = false )

Parameters

wks
[Output] The worksheet object to be attached
lpcszBookSheetName
[Input] The name of the attached worksheet
nCreate
[Input] Type of the created worksheet
bMatrixSheet
[Input] Created MatrixSheet or WorkSheet

Return

true for attach success or create success; otherwise false

Examples

EX1

//Befor run this example, make a datasheet (Matrixlayer or Worksheet) active in the project.
void attach_or_create_sheet_ex()
{     
        Datasheet dsDa;
        string strPage = Project.ActiveLayer().GetPage().GetName();           
        if(attach_or_create_sheet( dsDa, strPage))
                out_str("attach_success!");
        
        Datasheet dsDb;
        strPage = "[Book7]";//assume book7 doesn't exist.
        if(attach_or_create_sheet( dsDb, strPage,CREATE_HIDDEN,true))
                out_str("Create and attach a booksheet");
}

Remark

See Also

Header to Include

origin.h

Reference