This document summarizes a presentation about using Visual Studio Tools for Office (VSTO) for developing solutions that integrate with Microsoft Office applications like Excel, Word, and Outlook. It discusses key aspects of VSTO like application-level vs document-level projects, the ribbon designer, automating tasks with SQL Server and web services, and deploying VSTO solutions. The presentation aims to explain what VSTO is, how it works, and provide examples of using it with different Office applications.
2. João Tito Lívio (aka Tito)
.NET e SharePoint Consultant
Project Manager
Microsoft Most Valuable Professional (Office Development)
MCP + MCTS
3. Sumário
• Visual Studio Tools for Office (Tool?, VBA?, Polémica? Petições? VBA will dead?, Whatever!)
– O que é
– Como Funciona
– Breve introdução
• Application vs Document Level
• Criação de um Projecto VSTO
• Tipos de Pojectos Disponíveis
• Ribbon Visual Designer
• VSTO + Excel (Application Level)
– Automação + SQL server
– Automação + Web Services
• VSTO + Word (Document Level)
– Automação + SQL server
• VSTO + Outlook
– Automação com SQL Server e E-mails
4. Opiniões
1. Microsoft has stopped developing Visual Basic (classic) in 1999 and has spent huge effort on building
.Net framework. since then Microsoft is promoting .Net Framework and C# as the primary language of
choice. Visual Basic .Net is equally good and can used if you are already an expert in classic VB.
2. Microsoft “is planning “to retire VBA?. Office 2003 came with Scripting Engine based on Javascript (not
successful) and since then promoting the use of VSTO and Office PIAs in .Net.
3. Starting Office 2007, standard formats of Excel doesn't support embedding macros. Formats that
support Macros and VBA projects only run of located at Trusted locations or when security is lowered
below recommended levels.
4. Starting Office 2007, the VBA environment runs in the compatibility mode and having several issues
when dynamically invoking methods from the embedded VBA projects.
5. It is very clear future versions of Office will not support VBA. However, I don't know which will be the
last version supporting VBA (2012, 2015?).
6. One has to seriously think about investing their time in learning VBA, when it is going away soon. It is
getting very difficult to find junior VBA developers.
Source: http://www.execoder.com/2012/01/excel-development-vba-vs-vsto.html
5. VSTO o que é?
• Uma Tool para interagir com as Office App’s
• Interop Object Model via .NET Components
• Utiliza Managed Code (C# ou VB.NET)
• Não é necessário conhecimento de VBA
• Utiliza-se ao Nível da Aplicação Host ou Doc..
• É interpretado como COM Component
6. Como Funciona
VS App Interop Assembly Microsoft Office
Object Model Call’s
Event, Callbacks
Methods
8. Tipos de Projetos VSTO
APP
São Templates criados para desenvolver projetos
VSTO.
São os suportados oficialmente pela Microsoft,
embora podermos criar os nossos próprios
templates para qualquer aplicação Office pois os
NET Interops estão disponíveis
DOC
10. Ribbon Visual Designer
• Integração com a Application Host
• Usa Callbacks para comunicar com o Office
• XML Based
protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
{
return new MyRibbon();
}
20. Deploying Visual Studio 2010 VSTO
• The Microsoft .NET Framework
– Visual Studio Tools for the Office system 2010 can work with the Microsoft .NET Framework 3.5 or
Microsoft .NET Framework 4.
• The Microsoft Visual Studio 2010 Tools for Office Runtime.
– Visual Studio 2010 Tools for Office Runtime provides a runtime environment that manages add-ins
and document-level solutions.
• The primary interop assemblies for the 2007 Microsoft Office system or Microsoft Office 2010.
• Any utilities assemblies referenced by projects that target the .NET Framework 4.
Solution Specific Components
The installer package must install the following components to the user computer:
– The Microsoft Office document, if you create a document-level solution.
– The customization assembly and any assemblies it requires, Additional components such as configuration
files, The application manifest (.manifest). The deployment manifest (.vsto).
– Ver: http://msdn.microsoft.com/en-us/library/ff937654#Deployment
23. Referências e Links Imperdíveis
• Referências: Office Developer Center
– http://msdn.microsoft.com/en-us/office/aa905340
• Vídeos Interessantes e Links
Video: Developing Managed Applications for Office 2010 in Visual Studio 2010
Video: Embedding Type Information from Microsoft Office Assemblies
Video: Copying a Document to the End User Computer after a ClickOnce Installation
Video: Deploying Multiple Office Solutions in a Single ClickOnce Installer
• Links
– Deployment Overview (Office Development in Visual Studio)
– Advanced Office Solution Deployment
– Preparing Computers to Run or Host Office Solutions
– Updating Office Solutions
– How to: Install a ClickOnce Office Solution
– How to: Uninstall a ClickOnce Office Solution
– Troubleshooting Office Solution Deployment
25. Próximas reuniões presenciais
• 21/01/2012 – Janeiro
• 11/02/2011 – Fevereiro (Coimbra)
• 25/02/2011 – Fevereiro
• 24/03/2011 – Março
Reserva estes dias na agenda! :)