Export (0) Print
Expand All
8 out of 20 rated this helpful - Rate this topic

Office Solutions Development Overview

By using Microsoft Office 2003 or the 2007 Microsoft Office system as the front end for solutions, you can take advantage of the familiar Microsoft Office user interfaces and built-in tools such as spell checking, change tracking, and e-mail support. Another benefit of Microsoft Office solutions is offline use of the client-side part of the solution, which makes complex solutions more viable than they would be using a Web-based architecture.

For general information about developing with Microsoft Office, see Managed Code and Office Programming with Visual Studio, and the Microsoft Office Developer Center (http://msdn.microsoft.com/office/).

Document-Level Customizations and Application-Level Add-ins

Visual Studio Tools for Office contains project templates for document-level customizations and application-level add-ins. To decide on the best type of project for your solution, think about whether you want your code to run only when a specific document is open, or whether you want the code to be available whenever the Microsoft Office application is running.

Document-level customizations consist of an assembly that is associated with a single document, workbook, or template in Microsoft Office Word 2003 or Microsoft Office Excel 2003. The assembly is loaded when the associated document is opened. Features in customizations that you create are available only when the associated document is open. Customizations cannot make application-wide changes, such as displaying a new menu item when any document is open.

Application-level add-ins consist of an assembly that is associated with a Microsoft Office application. Typically, the add-in runs when the associated application is started, although users can also load add-ins after the application is already running. Features in add-ins that you create are available to the application itself, regardless of which documents are open.

The types of solutions you can create depend on which combination of Microsoft Visual Studio 2005 Tools for the Microsoft Office System (VSTO 2005) or Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System (VSTO 2005 SE) you have installed. For more information, see Features Available by Product Combination.

For more information about customizations and add-ins, see Office Solutions Architecture Overview.

VSTO 2005 Solutions

VSTO 2005 can help you create solutions by extending Word 2003 documents and Excel 2003 workbooks, and by creating add-ins for Outlook 2003 using Visual Basic and Visual C#. VSTO 2005 includes Visual Studio project templates for creating code behind Word documents, Word templates, Excel workbooks, Excel templates, and Outlook add-ins. The project templates include these components:

  • References to the main primary interop assemblies for the project.

  • References to required system components.

  • Project initialization.

  • Security settings that enable you to get started quickly.

VSTO 2005 can help you build two types of solutions: document-level customizations and application-level add-ins.

Document-Level Customizations for Word 2003 and Excel 2003

VSTO 2005 includes Visual Studio projects to help you write managed code in Visual Basic and C# behind Word 2003 and Excel 2003, using the Visual Studio environment. Your code responds to events that occur in the document or workbook. For more information, see Architecture of Visual Studio Tools for Office Solutions.

Application-Level Add-ins for Outlook 2003

A project template is available to help you create Outlook add-ins using managed code in Visual Basic and C#. For more information, see Getting Started Programming Application-Level Add-ins.

VSTO 2005 SE Solutions

VSTO 2005 SE can help you create add-ins for Microsoft Office 2003 and the 2007 Microsoft Office system by using Visual Basic and Visual C#. VSTO 2005 SE includes add-in projects for a variety of Microsoft Office applications. The project templates include these components:

  • References to the main primary interop assemblies for the project.

  • References to required system components.

  • Project initialization.

  • Security settings that enable you to get started quickly.

VSTO 2005 SE can help you build solutions quickly by taking advantage of the native features of each application. Your code responds to events that occur in the application. For more information, see Getting Started Programming Application-Level Add-ins and Office Solutions Architecture Overview.

Benefits of VSTO 2005 and VSTO 2005 SE

Visual Studio Tools for Office solutions provide the following benefits.

Deployment and Maintenance

Visual Studio Tools for Office solutions can be deployed by storing the compiled code (and potentially the document) in a shared location for easy maintenance, or by distributing copies of the assembly and document to each user to accommodate mobile work styles. For more information, see Deployment Models.

Security

Security is enforced using the security features provided by the Microsoft .NET Framework. The default policy for assemblies created using Visual Studio Tools for Office does not permit any assembly to run, which helps protect users from viruses and other malicious code. Before end users can take advantage of a document's managed code extensions, the administrator must explicitly grant full trust to the assembly. For more information, see Security in Office Solutions.

Offline Access

You can deploy local copies of the assembly and the document (if applicable) to each user when offline access is important. Alternatively, you can deploy an assembly to a network location that is accessible to all documents via a Web address (http:// or https://), which will enable Internet Explorer functionality to cache the assembly on the local computer. For more information, see Offline Model for Office Solutions.

Office Object Models

You can programmatically access the features of Microsoft Office applications by writing code that targets an application's object model, a process known as Automation. Object models are an arrangement of classes that expose functionality through various properties and methods. The object model for each Microsoft Office application is different and must be learned before Automation code can be written.

For information about classes and objects, see Classes: Blueprints for Objects. For more information about the object models of Microsoft Office applications, see Automating Applications Using the Office Object Model.

Primary Interop Assemblies

To call Microsoft Office application features using managed code, you must use an interop assembly. An interop assembly enables managed code to interact with an Office application's COM-based object model. Any number of interop assemblies may exist that describe a given COM type, and Visual Studio even generates one for you that has basic functionality. However, only one interop assembly is labeled the primary interop assembly (PIA), which contains the official description of the COM types as defined by the publisher of the type library. The primary interop assembly may contain certain customizations that make the types easier to use from managed code. It is best to use a primary interop assembly if one is available, rather than relying on an interop assembly from another source. For more information about primary interop assemblies, see Primary Interop Assemblies and the MSDN article, "Primary Interop Assemblies (PIAs)" (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/whypriinterop.asp).

See Also

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.