OriginObject::GetFormat

Description

Get object format into Tree

Syntax

Tree GetFormat( DWORD dwPropertiesFilter = FPB_ALL, DWORD dwObjFilter = FOB_ALL, BOOL bGetTagNames = TRUE, 
                BOOL bRelative = FALSE, DWORD dwPropertiesFilter2 = FPBEX_ALL, DWORD dwObjFilter2 = FOB2_ALL, 
                vector<int> * piaErrors = NULL, vector<string> * psaErrors = NULL )

Parameters

dwPropertiesFilter
[input] Filter for properties. See FILTERPROPERTYBITS enumeration in OC_const.h for bits description
dwObjFilter
[input] Filter for objects. See FILTEROBJECTBITS enumeration in OC_const.h for bits description
bGetTagNames
[input] get the real tagName for each treenode.
bRelative
[input]if TRUE, it will be considered relative to that object
dwPropertiesFilter2
dwObjFilter2
piaErrors
[optional][output] Array of errors. See OTHEMEERROR for possible values. If neither piaErrors nor psaErrors is used errors will be dumped into the script window.
psaErrors
[optional][output] Array of error strings. See E_STR_THEME_ERROR_* for possible strings. If neither piaErrors nor psaErrors is used errors will be dumped into the script window.

Return

A Tree object

Examples

EX1

// In this example, the format of a GraphLayer will be got and output to Output Window
// The result will be also saved in an xml file
void OriginObject_GetFormat_Ex1()
{
        GraphPage gp;
        gp.Create("origin");
        GraphLayer gl = Project.ActiveLayer();
        
        // to get all objects' all properties of GraphLayer into Tree
        Tree trFormat;
        trFormat = gl.GetFormat(FPB_ALL      , FOB_ALL, TRUE, TRUE);
        out_tree(trFormat); // output format tree
        
        string strSaveTo = GetAppPath(false) + "FormatTreeEx1.xml";
        if(trFormat.Save(strSaveTo))
        out_str("Format Tree xml file saved to "+strSaveTo);
        gp.Destroy();
}

EX2

//Get AXIS object's dimension properties. 
void OriginObject_GetFormat_Ex2()
{
        GraphPage gp;
        gp.Create("origin");
        GraphLayer gl = Project.ActiveLayer();      
        Tree trFormat;
        bool bRelative; 
        
        //When bRelative is TRUE
        // 1. the struct in trFormat is Root.Axes    
        // 2. Axes Node will include more nodes than when bRelative is FALSE
        bRelative = TRUE;
        trFormat = gl.GetFormat(FPB_DIMENSION, FOB_AXIS, TRUE, bRelative);
        printf("===AXIS format tree with bRelative is TRUE=== \n");
        out_tree(trFormat); // output format tree
        
        string strSaveTo = GetAppPath(false) + "FormatTreeEx2Case1.xml";
        if(trFormat.Save(strSaveTo))
                out_str("Format Tree xml file saved to "+strSaveTo);
        
        //When bRelative is FALSE
        //the struct in trFormat is Root.Page.Layer.Axes
        bRelative = FALSE; 
        trFormat = gl.GetFormat(FPB_DIMENSION, FOB_AXIS, TRUE, bRelative);
        printf("===AXIS format tree with bRelative is FALSE=== \n");
        out_tree(trFormat); 
        
        strSaveTo = GetAppPath(false) + "FormatTreeEx2Case1.xml";
        if(trFormat.Save(strSaveTo))
                out_str("Format Tree xml file saved to "+strSaveTo);
}

EX3

//Get all objects' properties of Worksheet 
void OriginObject_GetFormat_Ex3()
{     
        WorksheetPage wp;
        wp.Create("Origin");
        Worksheet wks = Project.ActiveLayer();
        
        Tree trFormat;
        trFormat = wks.GetFormat(FPB_ALL, FOB_ALL, TRUE, TRUE);
        out_tree(trFormat); // output format tree
        
        string strSaveTo = GetAppPath(false) + "FormatTreeEx3.xml";
        if(trFormat.Save(strSaveTo))
                out_str("Format Tree xml file saved to "+strSaveTo);
}

EX4

//Get all objects' properties of the Column 
void OriginObject_GetFormat_Ex4()
{
        WorksheetPage wp;
        wp.Create("Origin");
        
        Worksheet wks = Project.ActiveLayer();
        Column col(wks, 1);
        
        Tree trFormat;
        bool bRelative = TRUE;    
        printf("===Column format tree with bRelative is TRUE=== \n");
        trFormat = col.GetFormat(FPB_ALL, FOB_ALL, TRUE, bRelative);
        out_tree(trFormat); // output format tree
        
        string strSaveTo = GetAppPath(false) + "FormatTreeEx4.xml";
        if(trFormat.Save(strSaveTo))
                out_str("Format Tree xml file saved to "+strSaveTo);
}

Remark

Get object format into Tree

See Also

OriginObject::CopyFormat, OriginObject::ApplyFormat

header to Include

origin.h