XLL+ Class Library (7.0)

LabelledArgs Sample

A typical calculator add-in, using labelled arguments

Overview

This simple add-in contains a calculator for calculating the value and derivatives of a vanilla option, and is a simpler version of the function in the SimpOpt sample.

The BSValue2 function expects its arguments to be in two groups: RefArgs (which are the same for all options on the same underlying security) and StdArgs (which vary for each option). Each group of arguments is expected to be either in an ordered vector, or in a labelled two-column array.

The labelled layout is very flexible, and can also offer improved transparency to the user. Using labelled groups, the user can lay out arguments to suit their own purposes, rather than to suit the requirements of a particular calculator function. This is especially useful when different functions have different requirements for the order of arguments.

Features

The sample displays the following features:

Implementation

The following steps were significant in creating and completing the LabelledArgs application.

  1. Pre-cooked header and source files were added to the project, containing code for the business functions.
  2. The XLL+ Function Wizard was used to group the arguments and the wizard generated all the code required to unpack the values from the arrays passed by Excel.

Notes

The demonstration workbook, LabelledArgs.xls, shows how to use labelled arguments with the TFOLDT worksheet function for simple and powerful manipulation of large arrays of data.

Classes and functions used

CXlOper::Format | CXlOper::Ret

Sample project

Each sample project is located in a sub-directory of the Samples directory of the XLL+ installation. To use the sample project, open the solution file LabelledArgs.sln or the project file LabelledArgs.vcproj.

You can enable debugging under Excel by using the Setup Debugging command in the XLL+ ToolWindow.

When delivered, the help files are excluded from the build. You can enable the help build by selecting the files LabelledArgs.help.xml and LabelledArgs.chm in the Solution Explorer, and using the right-click menu to view Properties. Select the page "Configuration Properties/General" and set the "Excluded from build" property to "No". See Generating help in the User Guide for more information.

See Also

List of Sample Projects | Groups (User Guide) | SimpOpt sample | TFOLD sample