OriginObject::Load

Description

Load a Layer from a OGW/OGM file in an existing WorksheetPage object only

Syntax

OriginObject Load( LPCSTR lpcszFile, LPCSTR lpcszOption = NULL )

Parameters

lpcszFile
[input] name of the single window file
lpcszOption
[input]name of the layer to be loaded from a multi-layered single window file.
If not specified or the specified name cannot match any layer in window file, the first layer will be loaded.

Return

the loaded object

Examples

EX1

//Before run please prepare a worksheet and add a layer named "Sample", then save it to user path with filename "Test.OGW"
void OriginObject_Load_Ex1()
{
    Worksheet wksActive = Project.ActiveLayer();    
    if(wksActive)
    {
        WorksheetPage wksPage = wksActive.GetPage();
        
        string strFile = GetAppPath() + "Test.OGW";
        if(strFile.IsFile())
        {
            Worksheet wks;
            wks = wksPage.Load(strFile, "Sample");
        }
        else
            out_str("Fail to find this file");
    }
}

Remark

See Also

Page::Create, Page::AddLayer

Header to Include

origin.h