Applies a function filter with an Opt-In policy
This project demonstrates how to use a function filter to restrict which add-in functions are made available to users. The project applies an Opt-In policy, so that only add-in functions whose FunctionFilterOptIn property is specifically marked as True will be available to users.
The add-in functions included in the sample fall into 3 groups:
Because a function filter is being applied, ReadyFn & ReadyFn2 will be published, but NotReadyFn & NotReadyFn2 will not. Because it is an opt-in filter, OtherFn & OtherFn2, which are not marked, will not be published.
The only code added to the sample to achieve the filtering is the following:
#ifndef _DEBUG CXllFunctionFilterEventHandlerOptIn theFunctionFilter; #endif
This code declares a static global instance of CXllFunctionFilterEventHandlerOptIn, which automatically runs the filtering code just before add-in functions are registered with Excel. As a result, any function that is not marked as FunctionFilterOptIn = True will be suppressed.
Note that the code is surrounded by a #ifndef _DEBUG ... #endif
block, so that the filter only applies to the Release build.
This means that in the Debug build, the developer can continue to work with the functions that are filtered out.
For a discussion of function filtering, see the User Guide topic Publishing and suppressing add-in functions.
To edit the functions in this add-in, you need to load the extension file
FunctionFilter.xpe
which is located in the extensions directory of your XLL+ installation.
See Loading an extension file
for instructions.
CXllFunctionFilter | CXllFunctionFilterEventHandlerOptIn
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 PubDevIn.sln or the project file PubDevIn.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
PubDevIn.help.xml
and
PubDevIn.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.
List of Sample Projects | Publish Opt-Out Demo | Publish Run-time Demo | Publishing and suppressing add-in functions (User Guide)