VSTO consists of the following components:
- A selection of project templates that you can use to create various types of Office solutions.
- Designer support for visual layout of ribbons, action panes, and Custom task panels.
- Classes bui.U on top of the Office Primary Interop Assemblies (PlAs) that provide extensive capabilities.
VSTO supports both 2003 and 2007 versions of Office. The VSTO class library comes in two flavors, one for each of these Office versions, which use different sets of assemblies. For simplicity (and because of its richer feature set), this chapter focuses on the 2007 version.
Note that when you create a project. using one of the VSTO templates you may be asked to enable access to the VBA project system. This is necessary for VBA interaperabilitg.
The VSTO project templates can be divided into the following categories:
- Document-level customizations
- Application-level add-ins
- SharePoint workflow templates
- SharePoint InfoPath form templates
There are 2003 and 2007 versions of some of the project types, but as discussed earlier, you will look at only the 2007 versions here.
This chapter concentrates on the most commonly used project types, which are document-level customizations and application- leveladd-ins.
When you create a project of this type, you will generate all assembly that will be linked to an individual document – for example a Word document, Word template, or Excel workbook. When you load the document, the associated Office application will detect the customization, load the assembly, and make the VSTO customization available.
You might use a project of this type to provide additional functionality to a particular line-of-business document, or to a whole class of documents by adding customizations to a document template. You can include code that manipulates the document and the content of the document, including any embedded objects. You can also provide custom menus, including ribbon menus that you can create using the VS Ribbon Designer.
When you create a document-level project, you can choose to create a new document or to copy an existing document as a starting point for your development. You can also choose the type of document to create. For a Word document, for example, you can choose to create.
Application-level add-ins are different from document-level customizations in that they are available throughout their targeted Office application. You can access add-in code, which might include menus, document manipulations and so on, regardless of what documents are loaded.
When you start an Office application such as Word, it will look for associated add-ins that have entries in the registry and will load any assemblies that it needs to.
SharePolnt Workflow Templates
These projects provide a template to create SharePoint workflow applications. These are used to manage the flow of documents within SharePoint processes. By creating a project of this type, you can execute custom code at key times during the document lifecycle. .
InfoPath Form Templates
These are a form of document-level customization for InfoPath forms, although they use a slightly different methodology for Word and Excel document customizations and, so, are usually classified differently. You can create templates for InfoPath forms that extend the functionality of the InfoPath designer and that provide additional functionality and business logic for designers and end-users of InfoPath forms.
When you create an InfoPath Form template, you are presented with a wizard to specify exactly the sort of project you want to create.
This Wizard gives you quite a lot of flexibility in the source for the form you are creating – you can choose a variety of starting points (including forms on a SharePoint site). You can also create complete forms or template parts and limit functionality to browser compatible features if desired.
There are several features that you can use in the various VSTO project types, such as interactive panes and controls. The project type you use determines the features that are available to you. The following tables list these features according to the projects in which they are available.
Document-Level Customization Feature
Application-Level Add-In Features
Features Usable In All Project Types