http://netponto.org




 26ª Reunião Presencial @ LISBOA
DateTime.Parse("21-01-2012", new CultureInfo("pt-PT"));
João Tito Lívio (aka Tito)
.NET e SharePoint Consultant
Project Manager

Microsoft Most Valuable Professional (Office Development)
MCP + MCTS
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
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
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
Como Funciona

 VS App   Interop Assembly                         Microsoft Office

                             Object Model Call’s


                              Event, Callbacks
                                 Methods
Application vs Document Level
 A Aplicação Host Carrega o DLL   O Documento Carrega o DLL
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
Criar o Primeiro Projecto VSTO
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();
              }
Trabalhar com a Ribbon
Microsoft Excel e LOB
• Get Data from SQL server
• Interop with Excel
• Manage Workbooks and Worksheets
Excel Interop LOB
Microsoft Excel e Web Services
• Get Data from Service
• Interop with Excel
• Display Data
Excel Interop Web Services
Microsoft Word e LOB
• Get Data from SQL server
• Interop with Word
• Manage Document
Word Interop LOB
Microsoft Outlook e LOB
• Get Data from SQL server
• Interop with Outlook
• Manage Outlook Actions
Outlook Interop LOB
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
Patrocinadores “GOLD”
Patrocinador “Bronze”




Patrocinadores “Silver”
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
Questões?
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! :)
Obrigado!
Contactos Sociais e Blogs
http://www.tlivio.org

VSTO + LOB Apps

  • 1.
    http://netponto.org 26ª ReuniãoPresencial @ LISBOA DateTime.Parse("21-01-2012", new CultureInfo("pt-PT"));
  • 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 StudioTools 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 hasstopped 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 VSApp Interop Assembly Microsoft Office Object Model Call’s Event, Callbacks Methods
  • 7.
    Application vs DocumentLevel A Aplicação Host Carrega o DLL O Documento Carrega o DLL
  • 8.
    Tipos de ProjetosVSTO 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
  • 9.
    Criar o PrimeiroProjecto VSTO
  • 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(); }
  • 11.
  • 12.
    Microsoft Excel eLOB • Get Data from SQL server • Interop with Excel • Manage Workbooks and Worksheets
  • 13.
  • 14.
    Microsoft Excel eWeb Services • Get Data from Service • Interop with Excel • Display Data
  • 15.
  • 16.
    Microsoft Word eLOB • Get Data from SQL server • Interop with Word • Manage Document
  • 17.
  • 18.
    Microsoft Outlook eLOB • Get Data from SQL server • Interop with Outlook • Manage Outlook Actions
  • 19.
  • 20.
    Deploying Visual Studio2010 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
  • 21.
  • 22.
  • 23.
    Referências e LinksImperdí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
  • 24.
  • 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! :)
  • 26.
    Obrigado! Contactos Sociais eBlogs http://www.tlivio.org