2.2.4.34.1 PageBase::Detach

Description

Detach a Page object from an Origin page.

Syntax

BOOL Detach( )

Parameters

Return

Returns TRUE for success or FALSE for failure.

Examples

EX1

//Detach workbook
void PageBase_Detach_ex1()
{
    WorksheetPage wksPg;		//Create a new workbook
	wksPg.Create();
	string strName = wksPg.GetName();	//Output workbook name
	printf("The book name is %s\n", strName);

	if( wksPg.Detach() )
		printf("Detached %s, IsValid == %d\n", strName, wksPg.IsValid());
	else                
		printf("Failed to detach %s\n", strName);
}

EX2

//Detach matrix book 
void PageBase_Detach_ex2()
{
	MatrixPage matPg;	//Create a new matrix book
	matPg.Create("Origin");
	
	string strName = matPg.GetName();
	printf("The book name is %s\n", strName);
	
	matPg.Detach();
	printf("Detached %s, IsValid == %d\n", strName, matPg.IsValid());
}

EX3

//Detach graph
void PageBase_Detach_ex3()
{
    GraphPage gp;
    if( gp.Create("origin", CREATE_VISIBLE_SAME) )
    {
        string strName = gp.GetName();
        printf("Created a graph named %s\n", strName);
 
        if( gp.Detach() )
            printf("Detached %s, IsValid == %d\n", strName, gp.IsValid());
        else                
            printf("Failed to detach %s\n", strName);
    }
    else
        printf("Failed to create graph page.\n");
}

Remark

Detach a Page object from an Origin page. This will make the object invalid.

See Also

Header to Include

origin.h