XLL+ Class Library (7.0)

String arguments

String types

Excel versions before Excel 2007 pass strings to add-in functions as ANSI strings of 255 characters or less. Excel 2007 (and above) passes Unicode strings of up to 32767 characters.

A portable XLL add-in must therefore be able to handle either type of string.

CXlStringArg class

An add-in function generated by XLL+ uses two diffrent wrapper functions to handle being called from Excel 2003 and below and being called from Excel 2007 and above.

Each of the wrapper functions creates a portable object, of type CXlStringArg, which contains the string argument's value. The CXlStringArg object is passed to the common implementation function.

CXlStringArg is able to provide a Unicode string or an ANSI string, as the developer prefers.

You can use the CXlStringArg object anywhere that your code needs a const char* or const wchar_t* string pointer. The compiler will cast it as required, and the class will convert the data between ANSI and Unicode as required.

Next: Portable string types >>