SlideShare uma empresa Scribd logo
1 de 31
Getting Started with VSTO




   Copyright © by Application Developers Training Company
Objectives
•   Find out what kinds of solutions you can build
    using Microsoft Visual Studio 2005 Tools for the
    2007 Microsoft Office System
•   See how to create a simple Visual Studio Tools
    (VSTO) for Office solution
•   Investigate the components that make up a
    VSTO solution
•   Learn some basic concepts of writing managed
    code solutions using Visual Studio and the .NET
    Framework

       Copyright © by Application Developers Training Company
Agenda
•   Building Solutions with Microsoft Office
    System
•   Creating Your First VSTO 2005 SE Project
•   Introducing Managed Code




      Copyright © by Application Developers Training Company
Building Solutions with Microsoft Office
System
•   VBA has made it possible to create solutions
    that build on what Office provides
     Powerful but …
     Dated
•   Visual Studio Tools for Office
     Document-based solutions for Excel 2003 and Word
      2003
     Add-in solutions for most Office 2003 and Office
      2007 products
     Ability to use VB.NET, C#, and the .NET Framework

       Copyright © by Application Developers Training Company
Document-level:
What Can You Do with VSTO?       Excel 2003, Word 2003
                                Application-level:
 Visual Studio 2005              Outlook 2003
Tools for the Microsoft
    Office System
   (VSTO 2005)
                                    Visual Studio 2005 Tools
 Visual Studio 2005                  for the 2007 Microsoft
   Team System                            Office System
  (VS2005 Team)                        (VSTO 2005 SE)
 Visual Studio 2005
                                No built-in VSTO
    Professional Application-level solutions:
                                functionality
                   2003 and 2007
  (VS2005 Pro)
                 InfoPath 2007 Forms
      Copyright © by Application Developers Training Company
Starting with a Full Version of VSTO
•   VSTO 2005 or Team System
•   Document-level solutions
     Word 2003 Professional
     Excel 2003 Professional
     InfoPath 2007
•   Application-level solutions (add-ins)
     Word 2003/2007                 Outlook 2003/2007
                                     PowerPoint 2003/2007
     Excel 2003/2007
                                     Visio 2007
     InfoPath 2007


       Copyright © by Application Developers Training Company
Starting with Visual Studio 2005
Professional
•   Document-level solutions: None
•   Application-level solutions (add-ins)
       Word 2003/2007
       Excel 2003/2007
       InfoPath 2007
       Outlook 2003/2007
       PowerPoint 2003/2007
       Visio 2007




        Copyright © by Application Developers Training Company
What’s included in VSTO 2005 + VSTO
2005 SE
•   VS 2005 IDE
•   Templates for the solution types mentioned
•   VB and C# programming languages
•   Designers for WinForms, WebForms, database
    and data access, and classes
•   Support for XML and XSLT
•   SQL Server 2005 Developer Edition
•   Deployment Tools
•   Access 2003 Developer Extensions and
    Runtime
      Copyright © by Application Developers Training Company
Choosing a Development Language
•   You can use either Visual Basic or C#
•   Personal preference, but…
     If you use C# there are issues surrounding working
      with the Office object models that you need to know
      about
     If you use VB you should at least know how to read
      C# so you can read examples
•   In this course, we'll use mostly VB




       Copyright © by Application Developers Training Company
Agenda
•   Building Solutions with Microsoft Office System
•   Creating Your First VSTO 2005 SE
    Project
•   Introducing Managed Code




       Copyright © by Application Developers Training Company
VSTO 2005 SE Prerequisites
•   For Office 2003 solutions, you need one of:
     Microsoft Office 2003, Professional Edition
     Standalone version of Word 2003 or Excel 2003
•   For Office 2007 solutions, any edition of Office
    2007 will work
•   Even though you can run Office 2003 and Office
    2007 side-by-side, you can only develop VSTO
    2005 SE solutions for one or the other



       Copyright © by Application Developers Training Company
VSTO 2005 SE Prerequisites
•   In any case, be sure .NET Programmability
    Support is installed with the product
     .NET Programmability Support = Primary Interop
      Assemblies (PIAs)
     PIAs allow communication between managed code
      (.NET) and unmanaged code (COM)
     In Office 2003, do a Custom install
     In Office 2007, PIAs are installed by default
•   PIAs can also be downloaded and installed
    separately, or as part of a custom setup for your
    solution
       Copyright © by Application Developers Training Company
Office Edition Prerequisites: User's
Computer
•   Application-level solutions written for Office
    2003 will run on any edition of Office 2003
•   Document-level and application-level solutions
    written for Office 2003 will run on any edition of
    Office 2007




       Copyright © by Application Developers Training Company
Creating a New Document-Level
Solution
•   Excel 2003 and Word 2003 only
•   Either documents (.doc or .xls) or templates
    (.dot or .xlt)
•   Document-level solutions will work in Office
    2007, but you need to develop them in Office
    2003




       Copyright © by Application Developers Training Company
The Document
•   VSTO 2005 SE adds an ActiveX control
     Runtime Storage Control
     Embedded application manifest + cached data sets
•   Custom property named _AssemblyName
     Always has a value of * (an asterisk)
•   Custom property named _AssemblyLocation
     GUID
     Identifies the Runtime Storage Control




      Copyright © by Application Developers Training Company
The Assembly
•   Code runs in response to events, like Startup
    and Shutdown
•   If you open a doc with _AssemblyName = *
     VSTO loader starts the VSTO 2005 SE runtime
      (VSTOR)
     VSTOR checks the Code Access Security policy
     VSTOR uses the embedded application manifest to
      find the assembly
     Your code runs



       Copyright © by Application Developers Training Company
Creating a New Application-Level
Solution
•   Template adds two projects:
     Project for your solution containing a ThisAddIn class
     Project for setup so you can install on another
      computer
•   ThisAddIn members include
     Application points to the host application
     Office 2007: CustomTaskPanes allows you to add
      task panes to the host app's UI



       Copyright © by Application Developers Training Company
Loading an Add-In
•   Office product checks registry for add-ins to load
     Registry settings point to application manifest
     Application manifest points to deployment manifest
•   VSTO add-in loader (AddInLoader.dll) starts
•   AddInLoader starts VSTOR
•   VSTOR
       Reads application manifest
       Uses deployment manifest to see if newer version is available
       Creates application domain
       Checks Code Access Security policy
•   Your code runs


        Copyright © by Application Developers Training Company
Agenda
•   Building Solutions with Microsoft Office System
•   Creating Your First VSTO 2005 SE Project
•   Introducing Managed Code




       Copyright © by Application Developers Training Company
Introducing Managed Code
•   Whether VBA or VSTO 2005 SE, you still need
    to perform the same tasks
     Provide a UI
     Translate host app's features into code
     Work with variables, conditional logic, looping,
      specialized tasks
•   If you're coming from VBA
     Forms are entirely new
     Most VBA code will run with little modification, but…
     For many tasks, you can write more robust, more
      efficient, and shorter code by using .NET Framework
       Copyright © by Application Developers Training Company
.NET Framework Basics
•   Library of types that integrate with .NET's
    Common Language Runtime
•   Provides members for everything from data
    types to sending e-mail
•   Consistent architecture, so it's not as hard to
    learn as its size might indicate




       Copyright © by Application Developers Training Company
.NET Framework Examples
•   Working with the String Data Type
•   Getting File System Information
•   Exception Handling
•   Building Your Own Classes
•   Working with Windows Forms




       Copyright © by Application Developers Training Company
.NET Data Types
•   .NET Framework provides data types as
    members of the System namespace
       System.Boolean
       System.DateTime
       System.Double
       System.String
       …etc.
•   You can use familiar aliases, without the
    System-dot


        Copyright © by Application Developers Training Company
Working with Strings
•    .NET Framework data types provide
      Variable storage
      Shared members

    If result = String.Empty Then
        Console.WriteLine("No text entered")
    End If

    Console.WriteLine( _
     String.Format("You typed {0}", result)




        Copyright © by Application Developers Training Company
Working with Strings
•   System.String also provides string methods like
    the string functions in VBA
       .Length
       .ToUpper/.ToLower
       .Contains
       .IndexOf
       .Replace
•   In Visual Basic, you can still use the VBA
    functions


        Copyright © by Application Developers Training Company
Getting File System Information
•   FileSystem functions are available in VBA, but
    no fun to use
•   .NET Framework's System.IO namespace is
    much easier to work with
       Create, copy, move, delete folders or files
       Read/write files
       Get/set file attributes
       Parse paths and file name strings




        Copyright © by Application Developers Training Company
Exception Handling
•   You "catch" errors with a Try…Catch block
Try
   ' Code that might fail goes here
Catch
   ' Code that responds to error goes here
End Try
•   Use instance of the System.Exception class to
    determine what happened
Try
   ' Code that might fail goes here
Catch ex As Exception
 ' Can use Exception members to determine error
End Try
       Copyright © by Application Developers Training Company
Building Your Own Classes
•   Your classes
     Inherit from System.Object
     Can inherit from other .NET Framework classes, or
      your own
     Can provide multiple constructors, fields, properties,
      and methods




      Copyright © by Application Developers Training Company
Working with Windows Forms
•   WinForms are classes that inherit from
    System.Windows.Forms.Form
•   Many more controls than userforms
•   Support data binding to
     Database objects
     Web services
     Objects defined as classes in your solution
       o   Custom classes
       o   My.Settings class included in all VB projects




       Copyright © by Application Developers Training Company
Using a Windows Form in Your User
Interface
•   Instantiate with the New keyword
•   Use Show method (non-modal) or ShowDialog
    method (modal)

    Dim frm As New ExceptionsForm
    frm.Show()




      Copyright © by Application Developers Training Company
Binding to the My Namespace
•   Example: Add a data bound form to the add-in
    created earlier
•   Data is a setting in the My namespace
     Store last time form was loaded
     Display that time the next time form is loaded
     Show form when add-in starts up
•   Not particularly useful, but you get to use…
     Data Source Configuration Wizard
     Form designer
     Data binding design tools

       Copyright © by Application Developers Training Company

Mais conteúdo relacionado

Destaque

Open Solaris Virtual Box
Open Solaris Virtual BoxOpen Solaris Virtual Box
Open Solaris Virtual BoxJuanDavid17
 
Otoño 2015 european projects comunication_2 (3)
Otoño 2015 european projects  comunication_2 (3)Otoño 2015 european projects  comunication_2 (3)
Otoño 2015 european projects comunication_2 (3)CARMEN DIEZ CALZADA
 
Manual terapie ocupationala
Manual terapie ocupationalaManual terapie ocupationala
Manual terapie ocupationalaMIHAELA VLAS
 
Lynx mobile corporate (integración smartphones y tablets en la TI Corporativa)
Lynx mobile corporate (integración smartphones y tablets en la TI Corporativa)Lynx mobile corporate (integración smartphones y tablets en la TI Corporativa)
Lynx mobile corporate (integración smartphones y tablets en la TI Corporativa)Esteve Escuer
 
Biohumana práctica yogur
Biohumana práctica yogurBiohumana práctica yogur
Biohumana práctica yogurandrea19998
 
Ponencia sobre Hiperinnovación TEDxLaRioja 2011
Ponencia sobre Hiperinnovación TEDxLaRioja 2011Ponencia sobre Hiperinnovación TEDxLaRioja 2011
Ponencia sobre Hiperinnovación TEDxLaRioja 2011Toni Mascaró
 
Panamericano promo
Panamericano promoPanamericano promo
Panamericano promoLuis Moreno
 
David weber dahak 04 - empire from the ashes
David weber   dahak 04 - empire from the ashesDavid weber   dahak 04 - empire from the ashes
David weber dahak 04 - empire from the ashesAJC25
 

Destaque (20)

Open Solaris Virtual Box
Open Solaris Virtual BoxOpen Solaris Virtual Box
Open Solaris Virtual Box
 
Otoño 2015 european projects comunication_2 (3)
Otoño 2015 european projects  comunication_2 (3)Otoño 2015 european projects  comunication_2 (3)
Otoño 2015 european projects comunication_2 (3)
 
Migracion 2014 2015
Migracion 2014 2015Migracion 2014 2015
Migracion 2014 2015
 
facebook
facebookfacebook
facebook
 
Hugo
HugoHugo
Hugo
 
Manual terapie ocupationala
Manual terapie ocupationalaManual terapie ocupationala
Manual terapie ocupationala
 
Forum Promotions in seo
Forum Promotions in seoForum Promotions in seo
Forum Promotions in seo
 
Lynx mobile corporate (integración smartphones y tablets en la TI Corporativa)
Lynx mobile corporate (integración smartphones y tablets en la TI Corporativa)Lynx mobile corporate (integración smartphones y tablets en la TI Corporativa)
Lynx mobile corporate (integración smartphones y tablets en la TI Corporativa)
 
Biohumana práctica yogur
Biohumana práctica yogurBiohumana práctica yogur
Biohumana práctica yogur
 
Ethics of Practice Management in the 21st Century
Ethics of Practice Management in the 21st CenturyEthics of Practice Management in the 21st Century
Ethics of Practice Management in the 21st Century
 
Ponencia sobre Hiperinnovación TEDxLaRioja 2011
Ponencia sobre Hiperinnovación TEDxLaRioja 2011Ponencia sobre Hiperinnovación TEDxLaRioja 2011
Ponencia sobre Hiperinnovación TEDxLaRioja 2011
 
E commerce-salary-survey-eng
E commerce-salary-survey-engE commerce-salary-survey-eng
E commerce-salary-survey-eng
 
Formulario4
Formulario4Formulario4
Formulario4
 
SP-904_EN
SP-904_ENSP-904_EN
SP-904_EN
 
Panamericano promo
Panamericano promoPanamericano promo
Panamericano promo
 
Il Giornale Della Fiera - Editie Zomer 2011
Il Giornale Della Fiera - Editie Zomer 2011Il Giornale Della Fiera - Editie Zomer 2011
Il Giornale Della Fiera - Editie Zomer 2011
 
Clase 7 sust. pura 14 1
Clase 7 sust. pura 14 1Clase 7 sust. pura 14 1
Clase 7 sust. pura 14 1
 
David weber dahak 04 - empire from the ashes
David weber   dahak 04 - empire from the ashesDavid weber   dahak 04 - empire from the ashes
David weber dahak 04 - empire from the ashes
 
Análisis Matricial
Análisis MatricialAnálisis Matricial
Análisis Matricial
 
B2B New Media Essentials by Designated Editor at Swissnex Boston, Cambridge I...
B2B New Media Essentials by Designated Editor at Swissnex Boston, Cambridge I...B2B New Media Essentials by Designated Editor at Swissnex Boston, Cambridge I...
B2B New Media Essentials by Designated Editor at Swissnex Boston, Cambridge I...
 

Semelhante a Getting Started with VSTO

Presentation on Visual Studio Tools for Office (VSTO) at HyderabadTechies
Presentation on Visual Studio Tools for Office (VSTO) at HyderabadTechiesPresentation on Visual Studio Tools for Office (VSTO) at HyderabadTechies
Presentation on Visual Studio Tools for Office (VSTO) at HyderabadTechiespranavaa
 
VSTO + LOB Apps Information Matters
VSTO + LOB Apps Information MattersVSTO + LOB Apps Information Matters
VSTO + LOB Apps Information MattersComunidade NetPonto
 
VSTO + LOB Apps
VSTO + LOB AppsVSTO + LOB Apps
VSTO + LOB AppsJoao Livio
 
2005 - .NET SummerCamp: Web developmentwith IIS & ASP.NET webservices
2005 - .NET SummerCamp: Web developmentwith IIS & ASP.NET webservices2005 - .NET SummerCamp: Web developmentwith IIS & ASP.NET webservices
2005 - .NET SummerCamp: Web developmentwith IIS & ASP.NET webservicesDaniel Fisher
 
Developing for Office 2007 using VSTO 2005
Developing for Office 2007 using VSTO 2005Developing for Office 2007 using VSTO 2005
Developing for Office 2007 using VSTO 2005sudhakar
 
Office As A Development Platform
Office As A Development PlatformOffice As A Development Platform
Office As A Development PlatformChristof Sprenger
 
visual basic 2005 programmer certification
visual basic 2005 programmer certificationvisual basic 2005 programmer certification
visual basic 2005 programmer certificationVskills
 
ecs19 - Bill Ayers - RE-USE YOUR SHAREPOINT FRAMEWORK SKILLZ TO BUILD OFFICE ...
ecs19 - Bill Ayers - RE-USE YOUR SHAREPOINT FRAMEWORK SKILLZ TO BUILD OFFICE ...ecs19 - Bill Ayers - RE-USE YOUR SHAREPOINT FRAMEWORK SKILLZ TO BUILD OFFICE ...
ecs19 - Bill Ayers - RE-USE YOUR SHAREPOINT FRAMEWORK SKILLZ TO BUILD OFFICE ...European Collaboration Summit
 
1.microsoft visual studio 2010 test manager
1.microsoft visual studio 2010  test manager1.microsoft visual studio 2010  test manager
1.microsoft visual studio 2010 test managerAshwin Jujgar
 
Intro to the Office UI Fabric
Intro to the Office UI FabricIntro to the Office UI Fabric
Intro to the Office UI FabricThomas Daly
 
Unit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdfUnit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdfUjwala Junghare
 
System development using visual studio
System development using visual studioSystem development using visual studio
System development using visual studiojeff23_athisbest
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentationdimuthu22
 
Getting Started with .NET
Getting Started with .NETGetting Started with .NET
Getting Started with .NETLearnNowOnline
 
Accelerating time to delivery: Modernizing Application Development
Accelerating time to delivery: Modernizing Application DevelopmentAccelerating time to delivery: Modernizing Application Development
Accelerating time to delivery: Modernizing Application DevelopmentMicro Focus
 
Develop, Build, Package and Deploy Office Add-ins with Visual Studio - ESPC 2015
Develop, Build, Package and Deploy Office Add-ins with Visual Studio - ESPC 2015Develop, Build, Package and Deploy Office Add-ins with Visual Studio - ESPC 2015
Develop, Build, Package and Deploy Office Add-ins with Visual Studio - ESPC 2015Bram de Jager
 

Semelhante a Getting Started with VSTO (20)

Presentation on Visual Studio Tools for Office (VSTO) at HyderabadTechies
Presentation on Visual Studio Tools for Office (VSTO) at HyderabadTechiesPresentation on Visual Studio Tools for Office (VSTO) at HyderabadTechies
Presentation on Visual Studio Tools for Office (VSTO) at HyderabadTechies
 
Office And Vsto 200
Office And Vsto 200Office And Vsto 200
Office And Vsto 200
 
VSTO + LOB Apps Information Matters
VSTO + LOB Apps Information MattersVSTO + LOB Apps Information Matters
VSTO + LOB Apps Information Matters
 
VSTO + LOB Apps
VSTO + LOB AppsVSTO + LOB Apps
VSTO + LOB Apps
 
2005 - .NET SummerCamp: Web developmentwith IIS & ASP.NET webservices
2005 - .NET SummerCamp: Web developmentwith IIS & ASP.NET webservices2005 - .NET SummerCamp: Web developmentwith IIS & ASP.NET webservices
2005 - .NET SummerCamp: Web developmentwith IIS & ASP.NET webservices
 
Developing for Office 2007 using VSTO 2005
Developing for Office 2007 using VSTO 2005Developing for Office 2007 using VSTO 2005
Developing for Office 2007 using VSTO 2005
 
Working in Visual Studio.Net
Working in Visual Studio.NetWorking in Visual Studio.Net
Working in Visual Studio.Net
 
Office As A Development Platform
Office As A Development PlatformOffice As A Development Platform
Office As A Development Platform
 
visual basic 2005 programmer certification
visual basic 2005 programmer certificationvisual basic 2005 programmer certification
visual basic 2005 programmer certification
 
Visual Studio 2012 introduction
Visual Studio  2012 introductionVisual Studio  2012 introduction
Visual Studio 2012 introduction
 
ecs19 - Bill Ayers - RE-USE YOUR SHAREPOINT FRAMEWORK SKILLZ TO BUILD OFFICE ...
ecs19 - Bill Ayers - RE-USE YOUR SHAREPOINT FRAMEWORK SKILLZ TO BUILD OFFICE ...ecs19 - Bill Ayers - RE-USE YOUR SHAREPOINT FRAMEWORK SKILLZ TO BUILD OFFICE ...
ecs19 - Bill Ayers - RE-USE YOUR SHAREPOINT FRAMEWORK SKILLZ TO BUILD OFFICE ...
 
1.microsoft visual studio 2010 test manager
1.microsoft visual studio 2010  test manager1.microsoft visual studio 2010  test manager
1.microsoft visual studio 2010 test manager
 
Intro to the Office UI Fabric
Intro to the Office UI FabricIntro to the Office UI Fabric
Intro to the Office UI Fabric
 
Unit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdfUnit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdf
 
System development using visual studio
System development using visual studioSystem development using visual studio
System development using visual studio
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
 
Bp205
Bp205Bp205
Bp205
 
Getting Started with .NET
Getting Started with .NETGetting Started with .NET
Getting Started with .NET
 
Accelerating time to delivery: Modernizing Application Development
Accelerating time to delivery: Modernizing Application DevelopmentAccelerating time to delivery: Modernizing Application Development
Accelerating time to delivery: Modernizing Application Development
 
Develop, Build, Package and Deploy Office Add-ins with Visual Studio - ESPC 2015
Develop, Build, Package and Deploy Office Add-ins with Visual Studio - ESPC 2015Develop, Build, Package and Deploy Office Add-ins with Visual Studio - ESPC 2015
Develop, Build, Package and Deploy Office Add-ins with Visual Studio - ESPC 2015
 

Mais de LearnNowOnline

Windows 8: Shapes and Geometries
Windows 8: Shapes and GeometriesWindows 8: Shapes and Geometries
Windows 8: Shapes and GeometriesLearnNowOnline
 
SQL: Permissions and Data Protection
SQL: Permissions and Data ProtectionSQL: Permissions and Data Protection
SQL: Permissions and Data ProtectionLearnNowOnline
 
New in the Visual Studio 2012 IDE
New in the Visual Studio 2012 IDENew in the Visual Studio 2012 IDE
New in the Visual Studio 2012 IDELearnNowOnline
 
Attributes, reflection, and dynamic programming
Attributes, reflection, and dynamic programmingAttributes, reflection, and dynamic programming
Attributes, reflection, and dynamic programmingLearnNowOnline
 
Asynchronous Programming
Asynchronous ProgrammingAsynchronous Programming
Asynchronous ProgrammingLearnNowOnline
 
WPF: Working with Data
WPF: Working with DataWPF: Working with Data
WPF: Working with DataLearnNowOnline
 
Object oriented techniques
Object oriented techniquesObject oriented techniques
Object oriented techniquesLearnNowOnline
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScriptLearnNowOnline
 
SharePoint Document Management
SharePoint Document ManagementSharePoint Document Management
SharePoint Document ManagementLearnNowOnline
 
SharePoint: Introduction to InfoPath
SharePoint: Introduction to InfoPathSharePoint: Introduction to InfoPath
SharePoint: Introduction to InfoPathLearnNowOnline
 
Managing site collections
Managing site collectionsManaging site collections
Managing site collectionsLearnNowOnline
 
Sql 2012 development and programming
Sql 2012  development and programmingSql 2012  development and programming
Sql 2012 development and programmingLearnNowOnline
 
What's new in Silverlight 5
What's new in Silverlight 5What's new in Silverlight 5
What's new in Silverlight 5LearnNowOnline
 

Mais de LearnNowOnline (20)

Windows 8: Shapes and Geometries
Windows 8: Shapes and GeometriesWindows 8: Shapes and Geometries
Windows 8: Shapes and Geometries
 
SQL: Permissions and Data Protection
SQL: Permissions and Data ProtectionSQL: Permissions and Data Protection
SQL: Permissions and Data Protection
 
New in the Visual Studio 2012 IDE
New in the Visual Studio 2012 IDENew in the Visual Studio 2012 IDE
New in the Visual Studio 2012 IDE
 
Attributes, reflection, and dynamic programming
Attributes, reflection, and dynamic programmingAttributes, reflection, and dynamic programming
Attributes, reflection, and dynamic programming
 
Asynchronous Programming
Asynchronous ProgrammingAsynchronous Programming
Asynchronous Programming
 
WPF: Working with Data
WPF: Working with DataWPF: Working with Data
WPF: Working with Data
 
WPF Binding
WPF BindingWPF Binding
WPF Binding
 
A tour of SQL Server
A tour of SQL ServerA tour of SQL Server
A tour of SQL Server
 
Introducing LINQ
Introducing LINQIntroducing LINQ
Introducing LINQ
 
Generics
GenericsGenerics
Generics
 
Object oriented techniques
Object oriented techniquesObject oriented techniques
Object oriented techniques
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScript
 
SharePoint Document Management
SharePoint Document ManagementSharePoint Document Management
SharePoint Document Management
 
SharePoint: Introduction to InfoPath
SharePoint: Introduction to InfoPathSharePoint: Introduction to InfoPath
SharePoint: Introduction to InfoPath
 
Managing site collections
Managing site collectionsManaging site collections
Managing site collections
 
Web API HTTP Pipeline
Web API HTTP PipelineWeb API HTTP Pipeline
Web API HTTP Pipeline
 
Web API Basics
Web API BasicsWeb API Basics
Web API Basics
 
SQL Server: Security
SQL Server: SecuritySQL Server: Security
SQL Server: Security
 
Sql 2012 development and programming
Sql 2012  development and programmingSql 2012  development and programming
Sql 2012 development and programming
 
What's new in Silverlight 5
What's new in Silverlight 5What's new in Silverlight 5
What's new in Silverlight 5
 

Último

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 

Último (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Getting Started with VSTO

  • 1. Getting Started with VSTO Copyright © by Application Developers Training Company
  • 2. Objectives • Find out what kinds of solutions you can build using Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System • See how to create a simple Visual Studio Tools (VSTO) for Office solution • Investigate the components that make up a VSTO solution • Learn some basic concepts of writing managed code solutions using Visual Studio and the .NET Framework Copyright © by Application Developers Training Company
  • 3. Agenda • Building Solutions with Microsoft Office System • Creating Your First VSTO 2005 SE Project • Introducing Managed Code Copyright © by Application Developers Training Company
  • 4. Building Solutions with Microsoft Office System • VBA has made it possible to create solutions that build on what Office provides  Powerful but …  Dated • Visual Studio Tools for Office  Document-based solutions for Excel 2003 and Word 2003  Add-in solutions for most Office 2003 and Office 2007 products  Ability to use VB.NET, C#, and the .NET Framework Copyright © by Application Developers Training Company
  • 5. Document-level: What Can You Do with VSTO? Excel 2003, Word 2003 Application-level: Visual Studio 2005 Outlook 2003 Tools for the Microsoft Office System (VSTO 2005) Visual Studio 2005 Tools Visual Studio 2005 for the 2007 Microsoft Team System Office System (VS2005 Team) (VSTO 2005 SE) Visual Studio 2005 No built-in VSTO Professional Application-level solutions: functionality 2003 and 2007 (VS2005 Pro) InfoPath 2007 Forms Copyright © by Application Developers Training Company
  • 6. Starting with a Full Version of VSTO • VSTO 2005 or Team System • Document-level solutions  Word 2003 Professional  Excel 2003 Professional  InfoPath 2007 • Application-level solutions (add-ins)  Word 2003/2007  Outlook 2003/2007  PowerPoint 2003/2007  Excel 2003/2007  Visio 2007  InfoPath 2007 Copyright © by Application Developers Training Company
  • 7. Starting with Visual Studio 2005 Professional • Document-level solutions: None • Application-level solutions (add-ins)  Word 2003/2007  Excel 2003/2007  InfoPath 2007  Outlook 2003/2007  PowerPoint 2003/2007  Visio 2007 Copyright © by Application Developers Training Company
  • 8. What’s included in VSTO 2005 + VSTO 2005 SE • VS 2005 IDE • Templates for the solution types mentioned • VB and C# programming languages • Designers for WinForms, WebForms, database and data access, and classes • Support for XML and XSLT • SQL Server 2005 Developer Edition • Deployment Tools • Access 2003 Developer Extensions and Runtime Copyright © by Application Developers Training Company
  • 9. Choosing a Development Language • You can use either Visual Basic or C# • Personal preference, but…  If you use C# there are issues surrounding working with the Office object models that you need to know about  If you use VB you should at least know how to read C# so you can read examples • In this course, we'll use mostly VB Copyright © by Application Developers Training Company
  • 10. Agenda • Building Solutions with Microsoft Office System • Creating Your First VSTO 2005 SE Project • Introducing Managed Code Copyright © by Application Developers Training Company
  • 11. VSTO 2005 SE Prerequisites • For Office 2003 solutions, you need one of:  Microsoft Office 2003, Professional Edition  Standalone version of Word 2003 or Excel 2003 • For Office 2007 solutions, any edition of Office 2007 will work • Even though you can run Office 2003 and Office 2007 side-by-side, you can only develop VSTO 2005 SE solutions for one or the other Copyright © by Application Developers Training Company
  • 12. VSTO 2005 SE Prerequisites • In any case, be sure .NET Programmability Support is installed with the product  .NET Programmability Support = Primary Interop Assemblies (PIAs)  PIAs allow communication between managed code (.NET) and unmanaged code (COM)  In Office 2003, do a Custom install  In Office 2007, PIAs are installed by default • PIAs can also be downloaded and installed separately, or as part of a custom setup for your solution Copyright © by Application Developers Training Company
  • 13. Office Edition Prerequisites: User's Computer • Application-level solutions written for Office 2003 will run on any edition of Office 2003 • Document-level and application-level solutions written for Office 2003 will run on any edition of Office 2007 Copyright © by Application Developers Training Company
  • 14. Creating a New Document-Level Solution • Excel 2003 and Word 2003 only • Either documents (.doc or .xls) or templates (.dot or .xlt) • Document-level solutions will work in Office 2007, but you need to develop them in Office 2003 Copyright © by Application Developers Training Company
  • 15. The Document • VSTO 2005 SE adds an ActiveX control  Runtime Storage Control  Embedded application manifest + cached data sets • Custom property named _AssemblyName  Always has a value of * (an asterisk) • Custom property named _AssemblyLocation  GUID  Identifies the Runtime Storage Control Copyright © by Application Developers Training Company
  • 16. The Assembly • Code runs in response to events, like Startup and Shutdown • If you open a doc with _AssemblyName = *  VSTO loader starts the VSTO 2005 SE runtime (VSTOR)  VSTOR checks the Code Access Security policy  VSTOR uses the embedded application manifest to find the assembly  Your code runs Copyright © by Application Developers Training Company
  • 17. Creating a New Application-Level Solution • Template adds two projects:  Project for your solution containing a ThisAddIn class  Project for setup so you can install on another computer • ThisAddIn members include  Application points to the host application  Office 2007: CustomTaskPanes allows you to add task panes to the host app's UI Copyright © by Application Developers Training Company
  • 18. Loading an Add-In • Office product checks registry for add-ins to load  Registry settings point to application manifest  Application manifest points to deployment manifest • VSTO add-in loader (AddInLoader.dll) starts • AddInLoader starts VSTOR • VSTOR  Reads application manifest  Uses deployment manifest to see if newer version is available  Creates application domain  Checks Code Access Security policy • Your code runs Copyright © by Application Developers Training Company
  • 19. Agenda • Building Solutions with Microsoft Office System • Creating Your First VSTO 2005 SE Project • Introducing Managed Code Copyright © by Application Developers Training Company
  • 20. Introducing Managed Code • Whether VBA or VSTO 2005 SE, you still need to perform the same tasks  Provide a UI  Translate host app's features into code  Work with variables, conditional logic, looping, specialized tasks • If you're coming from VBA  Forms are entirely new  Most VBA code will run with little modification, but…  For many tasks, you can write more robust, more efficient, and shorter code by using .NET Framework Copyright © by Application Developers Training Company
  • 21. .NET Framework Basics • Library of types that integrate with .NET's Common Language Runtime • Provides members for everything from data types to sending e-mail • Consistent architecture, so it's not as hard to learn as its size might indicate Copyright © by Application Developers Training Company
  • 22. .NET Framework Examples • Working with the String Data Type • Getting File System Information • Exception Handling • Building Your Own Classes • Working with Windows Forms Copyright © by Application Developers Training Company
  • 23. .NET Data Types • .NET Framework provides data types as members of the System namespace  System.Boolean  System.DateTime  System.Double  System.String  …etc. • You can use familiar aliases, without the System-dot Copyright © by Application Developers Training Company
  • 24. Working with Strings • .NET Framework data types provide  Variable storage  Shared members If result = String.Empty Then Console.WriteLine("No text entered") End If Console.WriteLine( _ String.Format("You typed {0}", result) Copyright © by Application Developers Training Company
  • 25. Working with Strings • System.String also provides string methods like the string functions in VBA  .Length  .ToUpper/.ToLower  .Contains  .IndexOf  .Replace • In Visual Basic, you can still use the VBA functions Copyright © by Application Developers Training Company
  • 26. Getting File System Information • FileSystem functions are available in VBA, but no fun to use • .NET Framework's System.IO namespace is much easier to work with  Create, copy, move, delete folders or files  Read/write files  Get/set file attributes  Parse paths and file name strings Copyright © by Application Developers Training Company
  • 27. Exception Handling • You "catch" errors with a Try…Catch block Try ' Code that might fail goes here Catch ' Code that responds to error goes here End Try • Use instance of the System.Exception class to determine what happened Try ' Code that might fail goes here Catch ex As Exception ' Can use Exception members to determine error End Try Copyright © by Application Developers Training Company
  • 28. Building Your Own Classes • Your classes  Inherit from System.Object  Can inherit from other .NET Framework classes, or your own  Can provide multiple constructors, fields, properties, and methods Copyright © by Application Developers Training Company
  • 29. Working with Windows Forms • WinForms are classes that inherit from System.Windows.Forms.Form • Many more controls than userforms • Support data binding to  Database objects  Web services  Objects defined as classes in your solution o Custom classes o My.Settings class included in all VB projects Copyright © by Application Developers Training Company
  • 30. Using a Windows Form in Your User Interface • Instantiate with the New keyword • Use Show method (non-modal) or ShowDialog method (modal) Dim frm As New ExceptionsForm frm.Show() Copyright © by Application Developers Training Company
  • 31. Binding to the My Namespace • Example: Add a data bound form to the add-in created earlier • Data is a setting in the My namespace  Store last time form was loaded  Display that time the next time form is loaded  Show form when add-in starts up • Not particularly useful, but you get to use…  Data Source Configuration Wizard  Form designer  Data binding design tools Copyright © by Application Developers Training Company