XLL+ Class Library (7.0)

Function Element

A Function element will modify the code generation for a single wrapper method. The ExportedName attribute controls which add-in function is affected. The element has 1 required attribute (ExportedName) and 3 optional attributes: Wrap, WrappedName, and ReturnType. The Function element may also contain zero or more Argument elements.

Attributes

ExportedName

Required. The name of the add-in function to be wrapped, as it appears in Excel, and as the ExportedName attribute of the XlFunction element in the model file.

Wrap

The Wrap attribute controls whether a wrapper method will be generated for the specified function. Set it to None to remove the function from the list of wrapped functions. If missing, Always or Default, the function will be wrapped.

ReturnType

The function's return type, as it will appear in the C# wrapper function. Only the following basic types are supported: bool, DateTime, double, int, string, object. The return type may be a scalar (e.g. int), a vector (e.g. int[]) or a matrix (e.g. int[,]). A function that returns a vector or matrix of mixed types should use object[] or object[,] respectively.

WrappedName

If this attribute is provided, then it will be used as the name of the argument in the wrapper function. This can be useful in avoiding reserved words, or other naming conflicts.

NoExceptionOnError

If 0 or omitted, then an exception will be thrown if the function returns either an error value or a string beginning with one of the specified ErrorPrefixes. If 1, then an error value will be returned as a COM error value.

Element Information

Number of occurrences

Unlimited

Parent elements

Functions 

Child elements

ErrorPrefixes  Argument 

See Also

XLL Wrapper Generator Schema