VSTO 3.0 for Office 2007 Programming
上QQ阅读APP看书,第一时间看更新

Visual Studio integration

VSTO 3.0 provides a visual representation of Office applications inside the Visual Studio, in order to easily create a customized user interface. VSTO 3.0 is well integrated with Visual Studio 2008, which provides the integrity for Office developers to develop and deploy Microsoft Office solutions for Microsoft Office tools. Visual Studio 2008 enables developers to build scalable Office business applications, influence key Office UI features, support workflow, and create easier deployments. Office development is a part of Visual Studio 2008 Professional and later versions, which focuses mainly on the developers' compatibility and maintainability assurances.

Let's take a look at a typical VSTO project template for an Office 2007 application in Visual Studio 2008.

Visual Studio integration

In the preceding image, you can see the VSTO project templates for Office 2007 applications in Visual Studio 2008. Visual Studio 2008 has been packed with all of the VSTO 3.0 components needed to build an Office solution using VSTO. When installing Visual Studio 2008, all of the related installations, including project templates for VSTO 3.0, Office development references, and others, have been installed and fully-integrated into the new Visual Studio 2008 development environment.

Creating VSTO solutions

Visual Studio 2008 is very fast, collaborative, and flexible in developing and delivering a wave of innovative new Microsoft technologies, including enhanced language and data features. C# and VB.NET programming supported in Office 2007 is one of the enhanced language features, and easy data interaction with other data sources, such as Microsoft SQL server, is one of the data features. These features ensure that developers can rapidly create connected applications, deliver next generation software practices, and overcome application software development challenges.

Creating VSTO solutions

The preceding image represents the development environment of the Office solution. In this figure, the client represents the development environment machine; the VSTO 3.0 inside Visual Studio 2008 represents the VSTO integrated Visual Studio; Office 2007 Client tools are the Office applications, including Word, Excel, InfoPath, and others, that should be installed in the client machine for development.

The development environment using Visual Studio 2008 is capable of creating application-level, data-centric solutions with VSTO 3.0. The data-centric solutions are the functionalities that are siginificantly focused on data manipulation and data storage.

The Visual Studio 2008 development environment makes it possible to develop solutions with great design-time and runtime support for key Office 2007 System features, such as the Ribbon, Custom Task Panes, document-level solutions, Outlook forms regions, and so on.

The Ribbon is a new way of representing menu items in the Office application. In the new development environment, you have a visual designer within which you can drag-and-drop controls inside the Ribbon, and design your custom Ribbon menus easily. Even for a data-related operation such as creating data connections, you have a data connection wizard for easy creation of a data connection.

Let's take a look at how the Office project solution looks, once it's been created in Visual Studio 2008. For example, we'll load a Word 2007 document solution created with Visual Studio 2008 and VSTO, using project templates available in the development environment:

Creating VSTO solutions

The preceding image represents how the Office project solution for Word 2007 has been created in Visual Studio 2008. You can see all of the references listed as System.AddIn, System.Core, and so on. These are loaded automatically as a part of the project template. This provides the developer with easy-to-start programming by eliminating the manual process of adding references and validating the solution.

Office developers can integrate business data into documents by using XML-based data/view separation and programmability. For example, in InfoPath, you can easily integrate business data with the InfoPath forms, and you can program the data of the InfoPath, storing it as a separate file in XML format. You can also present the data in different views, depending on how the user wants to see it, in the user interface. You can develop solutions using the combined Outlook object model.

Viewing IDE Windows

Visual Studio is a fabulous Microsoft product designed especially for development activities. It is one of the most widely-used development tools among developers across the globe. It is built on an IDE, and enables developers to build different types of applications using Microsoft technologies. IDE is a software application for developing new software programs and applications that provides broad facilities to programmers for software development.

In general, IDE consists of a source code editor, compilers, and debuggers. Most readers will be familiar with the Visual Studio IDE. Visual Studio 2008 has an appearance similar to previous IDEs, but with more enhancements. By default, Microsoft Visual Studio IDE will provide you with IntelliSense, debugging, compilers for .NET programming, access to control controls, and the ability to build solutions. The latest enhancements such as visual designer for Ribbon, drag-and-drop controls, and enhanced debugging for Office applications will reduce the development time and increase the productivity of developers.

The in-built VSTO object model is designed to support .NET. And it's also simple! Many common functions are packaged and well-integrated. In the new version, tools such as Word, Excel, and InfoPath's target windows, are integrated directly into the IDE interface. This helps Office developers to build solutions without needing an advanced knowledge of the underlying object model. VSTO also has visual designers for Word 2007 and Excel 2007 that are in the Visual Studio IDE.

Viewing IDE Windows

In the preceding image, we can see how the visual designer for Word 2007 appears in Visual Studio 2008. In this environment, you have the drag-and-drop functionality and other easy-to-design layouts for the use of an Office developer. Visual Studio 2008 brings the visual designer for other Office tools such as Excel and Infopath into the IDE. In a similar way, the Visual Studio 2008 IDE brings the visual Ribbon designer for Office tools into the interface. The Ribbon designer allows an Office developer to visually design an Office Ribbon (officially called the Office Fluent user interface) using the well-known drag-and-drop interface, and interact with the Ribbon using standard .NET code.

Viewing IDE Windows

The preceding image shows the visual designer for the Ribbon in Office solution development, which simplifies the Ribbon development process for Office developers by providing drag-and-drop controls and easy access to resources. Similarly, Visual Studio 2008 simplifies and speeds up the development process of the actions pane, document-specific Task Panes, creating application-specific custom Task Panes, and Outlook Form Region Designer.

Debugging

Debugging is one of the most important tasks in software development, and a task that all developers will have run into many times in their programming lives. Developers have several debugging alternatives available for debugging their .NET applications that have DLL files in the Visual Studio IDE.

Visual Studio 2008 provides a strong set of build and debugging tools for Office solution development using VSTO 3.0. This is a big improvement over VSTO 2.0, which did not provide preconfigured debugging options. During configuration of the build, developers can select the components that they want to build, and exclude those that they want to avoid for the current build. A developer has the flexibility to build configurations for solutions as well as projects.