By: Eugene Starostin
Abstract: This article focuses on the capabilities of developing application-level extensions for Microsoft Office using Delphi Prism and Visual Studio Tools for Office.
First off, I would like to draw your attention to the key abbreviation in the title of this article. VSTO stands for Visual Studio Tools for Office, which is a set of classes and wizards delivered with Visual Studio 2008. VSTO is what the major part of Microsoft Office developments is based on these days. So, if you are determined to go on reading, you are welcome to the Visual Studio Ecosystem. Forget about the Visual Studio Shell which is installed by Delphi Prism if it does not find Visual Studio already installed. Yes, you need to have the full-fledged Visual Studio 2008, at least the Professional edition.
Another word combination which I used in the title of the article is "application-level extensions". Now it is the generally accepted term for what was earlier called COM Add-ins for Microsoft Office. One more variant is application-level add-ins.
Why may you want to use Delphi Prism for developing VSTO-based projects?
At first sight there can be only one answer here. You surely still prefer typing begin-end rather than braces or sub-end sub. And, like me, you haven’t given up programming in Delphi yet :) Though, we need to discuss right away the question of economics which is very crucial these days, or more precisely, that of economy. And there isn’t a trace of economy here. As I mentioned above, you need to have Visual Studio 2008 Professional (or Team System) and Delphi Prism.
However, for me this disadvantage is more than compensated for by just three features that Delphi Prism has on board, which I am going to use to the utmost in my Office extensions: dbExpress IV (aka Heterogeneous Database Access), DataSnap (Multi-tier Client Development) and parallel programming language features (support of the Microsoft PFX Framework).
Now VSTO directly supports only two programming languages – VB.NET and C#. It is these languages that are now in focus of Microsoft’s attention in the framework of Microsoft Office System development. But what shall we, begin-end aficionados, do? The other day I uploaded version 1 of the new extension for Visual Studio 2008 that supports VSTO-based solutions in Delphi Prism. You can download it from Code Central and use for free.
So, here is what you need for developing VSTO-based application-level extensions for Microsoft Office in Delphi Prism:
The VSTO Support for Delphi Prism Wizard is an extension for Visual Studio that allows you to generate VSTO-based projects in Delphi Prism. As you can see in the figure below, it adds the "VSTO add-in for Delphi Prism" item to the New Project dialog box (Other Project Types \ Extensibility).
Figure 1 – New Project window
When you run the wizard, it opens the dialog box which prompts you to select a host application for your application-level extension (see the picture below). Attention! You will be able to build COM add-ins only for the version of Microsoft Office which is installed on your machine, and only for those applications which are included in your Office.
Figure 2 – VSTO Support for Delphi Prism Wizard window
The result of the wizard’s work is a solution containing two projects: the add-in project itself and its setup project that you can use for add-in deployment. In Delphi Prism, the add-in project is a complete analog of the add-in projects in VB.NET or C# generated by VSTO. As for the setup project, it slightly differs from VSTO. The VSTO Support for Delphi Prism Wizard generates setup projects for both Office versions (VSTO does this for Office 2003 only) and adds a couple of custom actions that make deployment even easier than through VSTO (these custom actions are available in the source code).
Figure 3 – VSTO-based solution in Delphi Prism
After you have got a generated solution, you can start your VSTO-based development. And you will not find a single difference from development in VB.NET or C#.
Using Delphi Prism you can develop extensions for all Office applications and Office versions supported by VSTO, namely:
Microsoft Office 2003
Microsoft Office 2007
You have the following features of MS Office and VSTO available to you:
Office or Application versions
Application-level extensions (COM add-ins)
Office 2003 and 2007
MSI-based setup projects
Outlook form regions
Office Task panes
If you still remember what Office Sample Automation Server Wrapper Components are, and have little or no experience in VSTO development, you will find the resources below pretty helpful. Quite naturally, all of them will bring you to MSDN.
Subject to the above mentioned requirements, Delphi Prism provides full support for developing VSTO-based application-level add-ins for Microsoft Office, including code generation and msi-based deployment, and, of course, such in-demand features as the Ribbon designer, Outlook 2007 regions and Office Task panes. And there are no principle limitations in using the VSTO programming model when you employ Delphi Prism in your Office development.
Server Response from: ETNASC04