Scenarios for Using Add-Ins
Add-ins provide a mechanism to extend the core functionality of an application so that the new functionality will be available throughout the application. The key to writing effective add-ins in Office is to develop them so they look and feel like a natural extension to the Office application. A few examples of what add-ins can do in Office include the following:
- Extending existing functionality If your users need to print to a color printer but they often find it difficult to find the color printer nearest to them, you could write an add-in to mitigate this issue. The add-in could add a Print to Color Printer command to their File menu and a Print to Color Printer button on their standard toolbar. When the user clicks the button or selects the menu item, your add-in can handle that event and print to the nearest color printer.
- Integrating with data An add-in could be written that loads into Word and Excel that pulls data from a Web service and pastes it into the Office application. For example, the add-in could add a Paste Sales Information menu item. When the user selects the command from within Word, it would paste a table with the data from the Web service at the position your cursor is at in Word. In Excel, it would paste into the selected cells.
Functionality that only needs to be available for one particular document or template type is better written using the code behind a document pattern. For example, if sales information only needs to be retrieved when working with a Quarterly Report.doc file, it is better to put your code that retrieves the sales information into code behind the template or document for the quarterly report. This is an example of choosing the right context for your code. There is no reason to clutter up the application context with commands that are only used for a particular document or template.