2.2.4.32.40 OriginObject::SaveAs

Description

Saves (Serializes) an OriginObject into an Orgin recognized file type.

Syntax

BOOL SaveAs( LPCSTR lpcszFileName, DWORD dwCtrl = 0 )

Parameters

lpcszFileName
[input] File name (without extention) to which the object nust be saved.
The extention is added appropriately by the object which is intended to be saved depending on options.
dwCtrl
[input] Saving options. Could be 0 or one or more of the following: OOSAS_DATA (When on Data is saved with object. When off only styles, format etc saved,) , OOSAS_STORAGE (When off, "info" storage property and security info are not saved with the object, other wise storage information is saved along with the object)

Return

TRUE if saving succeeds else FALSE.

Examples

EX1

// Save a worksheet in various levels of completeness
void OriginObject_SaveAs_Ex1()
{
    string    strPath = GetAppPath(); // Gets the User folder
    WorksheetPage Wkspg = Project.Pages();
    if(Wkspg)
    {
        Worksheet wks = Wkspg.Layers(0);
        if(wks)
        {
            wks.SaveAs(strPath + "MyTemplateNoDataNoInfo", 0);    // Save as an OTP worksheet template without data or storage
            wks.SaveAs(strPath + "MyTemplateNoDataWithInfo", OOSAS_STORAGE);    // Save as an OTP worksheet template with storage, but no data
            wks.SaveAs(strPath + "MyWindowWithData", OOSAS_DATA);    // Save as an OGW file with data, but no storage
            wks.SaveAs(strPath + "MyWindowWithDataAndInfo", OOSAS_DATA | OOSAS_STORAGE);    // Save as an OGW file complete with data and storage
        }
    }
}

Remark

Saves (Serializes) an OriginObject into an Orgin recognized file type.

Currently works for Worksheet's only

See Also

Header to Include

origin.h