Udostępnij za pośrednictwem


Office Project Templates Overview

The Microsoft Office developer tools in Visual Studio 2010 includes project templates for creating the following types of Office solutions:

  • Document-level customizations

  • Application-level add-ins

For a detailed comparison of these types of Office solutions, see Office Solutions Development Overview.

The Office project templates are available in the New Project dialog box, under the Office node of the Visual C# and Visual Basic language nodes. There are different project templates for targeting Microsoft Office 2010 applications and applications in the 2007 Microsoft Office system. Each template generates a project with the appropriate configuration for the target application, including assembly references and debugging settings. In some cases, the solution that you create by building the project can run in either Microsoft Office 2010 or the 2007 Microsoft Office system on end user computers. For more information, see Running Solutions in Different Versions of Microsoft Office.

Each project provides files and code to get you started on a specific kind of solution. The generated code for each project includes startup and shutdown event handlers. You can add code to these event handlers to initialize your solution when it is loaded and to clean up your solution when it is unloaded. For more information, see Office Projects in the Visual Studio Environment and Events in Office Projects.

Note

The Office development tools are included with certain editions of Visual Studio 2010. For more information, see Configuring a Computer to Develop Office Solutions.

Document-Level Customizations

The Office node in the New Project dialog box provides the following project templates to get you started creating document-level customizations for Word and Excel:

  • Word 2007 Document and Word 2010 Document

  • Word 2007 Template and Word 2010 Template

  • Excel 2007 Workbook and Excel 2010 Workbook

  • Excel 2007 Template and Excel 2010 Template

The Word Document and Excel Workbook project templates provide code to get you started creating a solution that is based on a specific document or workbook. In these types of solutions, your code runs only when the associated document is open in Word or Excel.

The Word Template and Excel Template project templates behave identically to the Word Document and Excel Workbook project templates. However, the Word Template and Excel Template project templates makes it easy for users to create new local document or workbook copies of the customized template in your solution. The features in your solution are available from the new document that the user creates from the template.

For more information about the differences between choosing a document or template-based solution, see Document vs. Template Solutions.

Note

Word templates that reference managed code extensions cannot be used as global add-ins. The assembly is not called if the template is loaded from the Startup directory of Word. For more information, see Limitations of Global Templates and Excel Add-ins (.xla Files).

For information about getting started with these project types, see the following topics:

Application-Level Add-ins

The Office node in the New Project dialog box provides the following project templates to get you started creating application-level add-ins for the following applications:

  • Excel 2007 Add-in and Excel 2010 Add-in

  • InfoPath 2007 Add-in and InfoPath 2010 Add-in

  • Outlook 2007 Add-in and Outlook 2010 Add-in

  • PowerPoint 2007 Add-in and PowerPoint 2010 Add-in

  • Project 2007 Add-in and Project 2010 Add-in

  • Visio 2007 Add-in and Visio 2010 Add-in

  • Word 2007 Add-in and Word 2010 Add-in

When you create a project that is based on one of these project templates, the code in your solution runs when the associated application is open. Unlike document-level projects, your code is not associated with a single document.

For more information about getting started with these project types, see the following topics:

See Also

Tasks

How to: Create Office Projects in Visual Studio

Concepts

Getting Started Programming Document-Level Customizations for Excel

Getting Started Programming Document-Level Customizations for Word

Getting Started Programming Application-Level Add-Ins

Document vs. Template Solutions

Using Solution Explorer

Other Resources

Designing and Creating Office Solutions

Developing Office Solutions