2.2.4.46.9 Worksheet::CreateCopy

Description

Create a copy of an existing worksheet

Syntax

BOOL CreateCopy( Worksheet & wksSource, int nOption = CREATE_VISIBLE_SAME, DWORD dwCtrl = DCTRL_COPY_DEFAULT )

Parameters

wksSource
[input] The worksheet whose copy is made
nOption
[input] Options from CREATE_TEMP, etc. default is CREATE_VISIBLE_SAME.
dwCtrl
[input] Options from DCTRL_COPY_DATA, etc (OC_const.h). default is DCTRL_COPY_DEFAULT.
if the intent is to use the existing object attached to this object add the bit DCTRL_COPY_USE_EXIST_OKPTR.

Return

TRUE for success; otherwise FALSE.

Examples

EX1

//Create a copy of an existing worksheet. 
void Worksheet_CreateCopy_Ex1()
{
    Worksheet wks;
    
    WorksheetPage wp = Project.WorksheetPages(0);
    if(!wp)
        return;
    
    Worksheet wksSource(wp.GetName());
    
    int nOption = CREATE_VISIBLE_SAME;
    BOOL bRet = wks.CreateCopy(wksSource, nOption);
    
    printf("Original : %s; Copy : %s; Call returned %u\n", wks.GetName(), wksSource.GetName(), bRet);
}

Remark

Create a copy of the worksheet wksSource and attaches it to the object.

See Also

Datasheet::Create, Worksheet::CopyTo

Header to Include

origin.h