VSTO is a simple, but powerful framework for Office solution development. The framework brings an amazing number of benefits to the hands of every Office developer—form controls, classes, granular security, server scalability, object-oriented features, integrity, easy deployment, and many others.
VSTO allows managed and unmanaged code to be seamlessly put together into the same .NET assembly. This allows the developers to retain unmanaged code that cannot be ported over to the .NET framework without completely re-writing it. The Microsoft Office document or workbook with a linked or referenced managed code assembly is said to have managed code extensions. Managed extensions can be created by using VSTO on Microsoft Excel or Word, which are similar to macros but are much safer. With VSTO, you can create a template that only needs to be loaded with data.
Data caching, simply put, is storing data in memory for quick access. A Microsoft Office Word document or Excel workbook has a hidden control rooted inside it called the Runtime Storage Control, which stores cached data. VSTO provides data-caching capabilities as well as a ServerDocument
class in C# that can be used by an application external to Office (for example, the Winform application) to manipulate the data cache without accessing the object model of Word or Excel.
VSTO 3.0 gives you great control in being able to customize Office applications with reusable classes. Unlike VBA developers, VSTO developers are not limited to the VBA function library. VSTO provides a wide variety of classes, objects, and events to build business solutions for Microsoft Office. Using VSTO, developers can customize features for Office applications. These can be as simple as a button on the application's Command bar or adding custom task panes, or as complex as a data report template with access to different data sources.
VSTO provides Windows Forms controls that help you to develop a rich User Interface(UI) for your Office solution. By using a wide variety of control sets, VSTO developers can build rich data views for users. Each and every type of Windows Forms control has its own set of properties, methods, and events that make it suitable for different needs.
VSTO makes it easy to build rich User Interfaces by using controls inside the document and the Task Pane. For instance, you can create an animated one-button command to generate a form letter. For example, say a company has data content stored in its server, and a user wants to refer some content from the server while working in the document and without disturbing the current document view. Using VSTO, you can make the server content available inside the Task Pane of the document without interfering with the user's current work.
New for VSTO 3.0 and Office 2007, smart tags are strings that an Office application recognizes in a document. With Smart tags enabled, Microsoft Office Word attempts to recognize certain types of data in a document, visually indicated by a purple, dotted underline. Clicking on a smart tag brings up a list of possible actions for that particular data type. VSTO provides object models to Office developers, which can be used to create smart tags for documents and workbooks.
Windows Presentation Foundation(WPF) controls is a technology product of Microsoft Corporation. WPF can be used to build a rich and attractive look and feel for the user. WPF can be used in VSTO development environment, which supports C# programming, whereas VBA lacks this support. VSTO's visual designer supports the use of Windows Forms and Windows Presentation Foundation controls. WPF provides a reliable programming model for building client-based and web-based applications, and presents a clear separation between the business logic and the UI.
VSTO provides visual designers for Office applications such as Word 2007, Excel 2007, and others that appear inside the Visual Studio IDE(Integrated Development Environment). Creating a form in the Visual Studio IDE is as easy as dragging and dropping the form into the Microsoft Office document. Developers gain access to many tools and features in Visual Studio's IDE, such as IntelliSense (Microsoft's implementation of auto completion in the Visual Studio IDE), drag and drop controls, and data sources. VSTO also provides the Ribbon Visual Designer that lets you customize the Office Ribbon and program it by using a simple .NET application-like programming model. The following image explains how IntelliSense helps developers using Visual Studio IDE.
The VSTO security model involves wide support from Trust Center in Microsoft Office and the Visual Studio Tools for Office runtime, which helps resolve the security issues common to VBA code. There are many disadvantages to the VBA security model. An abundant number of viruses are easily developed using VBA macros. To run VBA macros safely, you have to set the security to high on the user machine, and digitally sign the code. More importantly, these operations need to be performed manually by the user. In VSTO 3.0, the Security Model has been changed. VSTO builds the security policy that is required to run and debug your solution on your computer every time that you build a project. The Assemblies are signed before publishing—this is done by Visual Studio 2008. Preferably, you obtain a certificate from a globally-acknowledged Certificate Authority or from an internal Certificate Authority, if the solution is only for an internal solution, and sign the manifests using the signing properties page in Visual Studio. Later, you publish the solution to its appropriate location.
VSTO solutions developed for an Office system are easier to maintain. Updating the deployed solutions, changing the code, and updating a single assembly will help more resources doing the same thing in multiple copies of the same documents. All of the code will reside inside the assembly—a partially-compiled code library that contains the logical unit of code inside it as a single dynamic link library (
.dll
) file. With macros, the script resided inside the Office documents. Whenever you wanted to update the code, you had to modify every single document that contained it. With VSTO 3.0, managing application-level add-ins can be done by simply changing the code and updating the single assembly, instead of doing the same thing for multiple copies of the same document.