Books
in black and white
Main menu
Share a book About us Home
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

Excel add in development in C++ Aplications in finance - Dalton S.

Dalton S. Excel add in development in C++ Aplications in finance - Wiley publishing , 2005. - 425 p.
ISBN 0-470-02469-0
Download (direct link): exceladdindevelopmentincand2005.pdf
Previous << 1 .. 88 89 90 91 92 93 < 94 > 95 96 97 98 99 100 .. 168 >> Next

Excel4(xlfGetNote, &RetVal, 1, &Arg); return RetVal.ExtractXloper(true);
}
8.9.9 Information about a window: xlfGetWindow
Overview: The function returns information about an open worksheet
window.
The first argument corresponds to the information you are trying to get. The meaning of the most useful of these 31 values is given in Table 8.15.4
4 For values not covered, see the Macro Sheet Function Help included with the Excel SDK.
Accessing Excel Functionality Using the C API
223
The second is the name of the window about which you want to know something. If omitted, information about the active window is returned. (Remember that Excel enables multiple windows to be opened providing views to the same workbook.) The text should be entered in the form it appears in the window title bar, i.e. Book1.xls or Book1.xls:n if one of multiple open windows.
Enumeration value: 187 (xbb)
Callable from: Commands and macro sheet functions.
Return type: Various, depending on the value of the first argument.
Arguments: 1: ArgNum: A number from 1 to 31 inclusive.
2: WindowName: (Optional.) Window name as text.
Table 8.15 Selected arguments to xlfGetWindow
ArgNum What the function returns
1 • If more than one sheet in the workbook, returns the name of the active sheet in the form [Bookl ,xls]Sheet1 • If only one sheet in the workbook with a different name to the workbook, returns the sheet name in the form [Bookl ,xls]Sheet1 • If one sheet in the workbook, both having the same name, returns the name of the workbook in the form Bookl .xls • If a window of that name is not open, returns #VALUE!
2 The number of the window. Always 1 unless there are multiple windows, in which case the number displayed after the colon in the window title.
7 True if hidden.
8 True if formulas are displayed.
9 True if gridlines are displayed.
10 True if row and column headings are displayed.
11 True if zeros are displayed.
20 True if window is maximised.
23 The size of the window: 1 = Restored 2 = Minimised 3 = Maximised
24 True if panes are frozen.
(continued overleaf)
224
Excel Add-in Development in C/C++
Table 8.15 (continued)
ArgNum What the function returns
25 The magnification of the window as a % of normal size.
26 True if horizontal scrollbars displayed.
27 True if vertical scrollbars displayed.
28 The ratio of horizontal space allotted to workbook tabs versus the horizontal scrollbar. (Default = 1 : 0.6.)
29 True if workbook tabs displayed.
30 The title of the active sheet in the window in the foim [Bookl ,xls]Sheet1
31 The workbook name, in the form Book.xls excluding the read/write status.
The Excel4() function set-up and call are as shown in the following C/C++ code example of an exportable function that wraps up the call to xlfGetWindow and returns whatever is returned from that call:
xloper * stdcall get_window(int arg_num, char *window_name)
{
xloper argl, arg2; static xloper ret_xloper;
if(arg_num < 1 || arg_num > 31) return p_xlErrValue;
argl.xltype = xltypeInt; argl.val.w = arg_num;
if(window_name)
{
arg2.xltype = xltypeStr;
arg2.val.str = new_xlstring(window_name);
}
else
arg2.xltype = xltypeMissing;
Excel4(xlfGetWindow, &ret_xloper, 2, &arg1, &arg2);
// Tell Excel to free up memory that it might have allocated for // the return value.
ret_xloper.xltype | = xlbitXLFree;
if(window_name)
free(arg2.val.str);
return &ret_xloper;
}
Accessing Excel Functionality Using the C API
225
The following code is equivalent to the above, but uses the cpp_xloper class.
xloper * stdcall get window(int arg num, { cpp xloper Arg1(arg num, 1, 31); char *window name)

if(iArg1.IsType(xltypeInt)) return p xlErrValue;
cpp xloper Arg2(window name); cpp xloper RetVal; Excel4(xlfGetWindow, &RetVal, 2, &Arg1, return RetVal.ExtractXloper(true); } &Arg2);
8.9.10 Information about a workbook: xlfGetWorkbook
Overview: The function returns information about an open workbook.
The first argument corresponds to the information you are trying to get. The meaning of the most useful of these 38 values is given in Table 8.16.5
The second is the name of the workbook about which you want to know something. If omitted information about the active workbook is returned.
Enumeration value: 268 (x10c)
Callable from: Commands and macro sheet functions.
Return type: Various, depending on the value of the first argument.
Arguments: 1: ArgNum: A number from 1 to 38 inclusive.
2: WorkbookName: (Optional.) Workbook name as text.
Table 8.16 Selected arguments to xlfGetWorkbook
ArgNum What the function returns
1 A horizontal array of the names of all sheets in the workbook.
3 A horizontal array of the names of workbook’s currently selected sheets.
4 The number of sheets in the workbook.
14 True if the workbook structure is protected.
(continued overleaf )
5 For values not covered, see the Macro Sheet Function Help included with the Excel SDK.
226
Excel Add-in Development in C/C++
Table 8.16 (continued )
Previous << 1 .. 88 89 90 91 92 93 < 94 > 95 96 97 98 99 100 .. 168 >> Next