XLL+ Class Library (7.0)

TFold Sample

Demonstrates the use of the CXlOper class, in a useful worksheet function that constructs and manipulates arrays


This sample add-in demonstrates the use of the CXlOper class.

The TFOLD function in the add-in is a very useful utility for creating arrays of cells from individual cells and ranges in worksheets. If you want to use an add-in function that expects arguments to be in a certain shape, you can use TFOLD to create a correctly shaped array on the fly, instead of changing your worksheet to suit the demands of the function.


The TFOLD.XLS demo workbook shows TFOLD and TFOLDT is use.

A very powerful use of TFOLDT is also shown in LabelledArgs.xls, which is part of the LabelledArgs sample.


Under Visual Studio .NET 2003, it was necessary to switch off the optimization flag /Ob2 under the Release configuration, and replace it with /Ob1. Using the /Ob2 optimization causes runtime exceptions. This compiler behavior was fixed for Visual Studio 2005, 2008 and 2010, and the standard optimization settings (/O2) can be used.

Classes and functions used

CXlOper::GetDims | CXlOper::IsMissing | CXlOper::VectorCell | CXlOper::AllocArray | CXlOper::Cell | CXlOper::RetError | 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 TFold.sln or the project file TFold.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 TFold.help.xml and TFold.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 | LabelledArgs sample