2.1.14.4.8 out_tree_to_wks


Description

output result from tree to worksheet.

Syntax

int out_tree_to_wks( const TreeNode & tr, Worksheet & wks )


int out_tree_to_wks( const TreeNode & tr, LPCSTR lpcszBookName, DWORD dwCtrl = CREATE_VISIBLE | CREATE_LOAD_1ST_LAYER_ONLY )

Parameters

tr
[input] the tree to output
wks
[input] the worksheet to hold tree report.


tr
[input] the tree to output
lpcszBookName
[input] the name of worksheet to show result in tr
dwCtrl
[input] control how the worksheet will be shown when create the new workbook.

Return

returns row index that tree data were added

Examples

EX1

void out_tree_to_wks_ex1()
{    
    Tree tr;
    tr.from.dVal = 1.0;
    tr.to.dVal = 10.0;
    tr.size.nVal = 10;
    
    WorksheetPage wksPage;
    wksPage.Create();
    Worksheet wks = wksPage.Layers();
    
    // put result from tree to newly created worksheet
    int nRow = out_tree_to_wks(tr, wks);
    if(nRow >= 0)
        printf("Output to worksheet successfully, and row from %d\n", nRow);
    
    // append result from tree to existed worksheet
    nRow = out_tree_to_wks(tr, wks);
    if(nRow >= 0)
        printf("Output to worksheet successfully, and row from %d\n", nRow);

    //please check worksheet, there are two rows with the same results.
}


EX2

void out_tree_to_wks_ex2(string strBookName)
{
    Worksheet wks(strBookName);
    if(!wks)
        return;
    
    Tree tr;
    tr.from.dVal = 1.0;
    tr.to.dVal = 10.0;
    tr.size.nVal = 10;
    
    out_tree_to_wks(tr, wks);    
}

Remark

See Also

Header to Include

origin.h

Reference