okoc_create_workbook

 

Description

creating a new workbook with more controls

Syntax

BOOL okoc_create_workbook( Worksheet * pwks, LPCSTR lpcszNamePrefix, LPCSTR lpcszTemplate, int nOption = CREATE_VISIBLE, int nRows = -1, int nCols = -1, int nAutoAddRows = -1, int nLabel1 = -1, int nLabel2 = -1 )

Parameters

pwks
[output] Worksheet pointer to receive result
lpcszNamePrefix
[input] resulting workbook name to be enumerated
lpcszTemplate
[input] template to create book
nOption
[input] display options, CREATE_VISIBLE, CREATE_HIDDEN etc
nRows
[input] number of rows to start with, -1 to keep what is in template
nCols
[input] number of columns to start with, -1 to keep what is in template
nAutoAddRows
[input] 0 to disable auto add rows, 1 to turn on, -1 to keep current template setting
nLabel1
[input] first row label type RCLT_LONG_NAME, RCLT_UNIT, RCLT_COMMENT etc, or -1 if keep template seting
nLabel2
[input] second row label type RCLT_LONG_NAME, RCLT_UNIT, RCLT_COMMENT etc, or -1 if keep template seting

Return

true for success

Examples

EX1

#include <okocutils.h> // not included in origin.h, so you must add this
void create_new_book(int nCols = 5, int nRows = 10)
{
    Worksheet wks;
    int nAutoAddRows = 1;
    int nLabel1 = RCLT_LONG_NAME;
    if (okoc_create_workbook(&wks, "Table1", "Table", CREATE_HIDDEN, nRows, nCols, nAutoAddRows, nLabel1))
    {
        WorksheetPage    wp = wks.GetPage();
        wp.SetShow();
    }
}

Remark

See Also

header to Include

okocUtils.h

Reference