You are previewing VSTO For Dummies.
O'Reilly logo
VSTO For Dummies

Book Description

Learn to build custom Office applications with this new Microsoft development tool

Designed to attract both VBA (Visual Basic for Applications) and Visual Studio developers, VSTO (Visual Studio Tools for Office) is a Visual Studio add-in that makes it easy to create custom Office applications. This book shows developers step by step how to work with VSTO tools to create real-world applications for Word, Outlook, and Excel.

  • VSTO enables developers to easily create custom applications for Microsoft Office

  • In the fun and friendly For Dummies style, this book explains how to build effective user interfaces and integrate VSTO applications with Sharepoint and other Microsoft server products

  • All code is presented in Visual Basic, making the book accessible to both VB and VBA programmers

VSTO For Dummies will get you up and running with this exciting technology quickly and easily.

Table of Contents

  1. Copyright
  2. About the Authors
  3. Authors' Acknowledgments
  4. Publisher's Acknowledgments
  5. Introduction
    1. About This Book
    2. Conventions Used in This Book
    3. What You're Not to Read
    4. Foolish Assumptions
    5. How This Book Is Organized
      1. Part I: Introducing VSTO
      2. Part II: VSTO Construction
      3. Part III: Developing for SharePoint
      4. Part IV: Finishing Up
      5. Part V: The Part of Tens
    6. Icons Used in This Book
    7. Where to Go from Here
  6. 1. Introducing VSTO
    1. 1. Getting Started with VSTO
      1. 1.1. Harnessing the Power of VSTO
        1. 1.1.1. Talking about add-ins and Customized Documents
        2. 1.1.2. Solving your problems with four VSTO features
          1. 1.1.2.1. Add functionality to Office
          2. 1.1.2.2. Leverage Office functionality
          3. 1.1.2.3. Make documents that think
          4. 1.1.2.4. Make connections between existing applications and Office
      2. 1.2. Exploring the Different Versions of VSTO
        1. 1.2.1. Visual Studio 2003 and 2005
        2. 1.2.2. VSTO 2005 SE
        3. 1.2.3. VSTO 3.0
        4. 1.2.4. Visual Studio 2010 and VSTO 4.0
        5. 1.2.5. Office 2003
        6. 1.2.6. Office 2007
        7. 1.2.7. Earlier versions
      3. 1.3. Installing VSTO
        1. 1.3.1. Requirements
        2. 1.3.2. Supporting software
      4. 1.4. Using VSTO in Visual Studio
        1. 1.4.1. Using VSTO projects
        2. 1.4.2. Working toward a finished product
        3. 1.4.3. Starting with the end in mind
          1. 1.4.3.1. An installer
          2. 1.4.3.2. A document file
    2. 2. Building an Add-in
      1. 2.1. What's an Add-In, Anyway?
      2. 2.2. Making a New Project
      3. 2.3. Making the Add-In Do Amazing Things
        1. 2.3.1. Adding a user interface to your add-in
        2. 2.3.2. Putting some data in that add-in
      4. 2.4. Making the Add-In Work
      5. 2.5. Seeing Your Add-In in Action
    3. 3. Making Your Documents Smart
      1. 3.1. What Is a Smart Document, Anyway?
      2. 3.2. Taking a Peek at a Quick Example
        1. 3.2.1. Creating a new project
        2. 3.2.2. Adding basic customizations
        3. 3.2.3. Getting a little more advanced
      3. 3.3. Seeing Your Work in Action
    4. 4. Designing for VSTO
      1. 4.1. Meeting the Growing Requirements of Users
        1. 4.1.1. Compacting the most work into the least time
        2. 4.1.2. Using pre-existing functionality
      2. 4.2. Planning for a Project
        1. 4.2.1. Scoping out the system
        2. 4.2.2. Gathering requirements
        3. 4.2.3. Designing the feature set
      3. 4.3. Figuring Out What VSTO Can Do for You
        1. 4.3.1. Individual applications
        2. 4.3.2. Working together
      4. 4.4. Designing Powerful Applications Quickly
        1. 4.4.1. Defining your scope
        2. 4.4.2. The power of Smart Clients
        3. 4.4.3. Using powerful libraries
        4. 4.4.4. Leveraging a good IDE
        5. 4.4.5. Understanding the limitations
      5. 4.5. Getting Help from VSTO
        1. 4.5.1. A platform familiar to users
        2. 4.5.2. Library of work
        3. 4.5.3. Existing functionality
  7. 2. VSTO Construction
    1. 5. Building Word Add-Ins
      1. 5.1. Getting Used to the Ribbon
      2. 5.2. Customizing the Ribbon with Add-Ins
        1. 5.2.1. Creating an Office add-in project with a Ribbon
        2. 5.2.2. Adding a Ribbon to your project
      3. 5.3. Building Custom Task Panes
        1. 5.3.1. Adding controls to the Task pane
        2. 5.3.2. Adding code to the Task pane
        3. 5.3.3. Adding functionality to the Task pane
      4. 5.4. Handling Events in Add-Ins
        1. 5.4.1. Creating an event handler
        2. 5.4.2. Accessing global document information
        3. 5.4.3. Creating your own events
        4. 5.4.4. Taking an interface to the bank
        5. 5.4.5. Giving the bank some class
        6. 5.4.6. Calling up the pane from Word
      5. 5.5. Putting the Account Panel All Together
        1. 5.5.1. Adding a Ribbon control
        2. 5.5.2. Making the Task pane appear and disappear
    2. 6. Customizing Word Documents
      1. 6.1. Exploring the Word Object Model
        1. 6.1.1. The Application object
        2. 6.1.2. The Document object
          1. 6.1.2.1. Opening a document
          2. 6.1.2.2. Saving and closing a document
        3. 6.1.3. The Range and Selection objects
          1. 6.1.3.1. Selecting text
          2. 6.1.3.2. Moving around a document
          3. 6.1.3.3. Inserting text
        4. 6.1.4. The Bookmark object
      2. 6.2. Working with Tables
      3. 6.3. Designing a Smart Word Template
        1. 6.3.1. The template! It's alive, alive!
        2. 6.3.2. Coding up a salesperson
        3. 6.3.3. Showing you the data
          1. 6.3.3.1. Taking a look at the Data Source window
          2. 6.3.3.2. Selecting controls
          3. 6.3.3.3. Adding databound content controls to the template
      4. 6.4. Programming the Ribbon
        1. 6.4.1. Browsing the Ribbon controls
        2. 6.4.2. Adding a Ribbon to marketing letters
          1. 6.4.2.1. Adding controls to the Ribbon
          2. 6.4.2.2. Putting the finishing touches on the Ribbon
          3. 6.4.2.3. Moving to a new record
        3. 6.4.3. Seeing your work in action
    3. 7. Building an Excel Add-In
      1. 7.1. Creating a New Project
      2. 7.2. Designing a Dialog Box
        1. 7.2.1. Using the dialog box in your add-in
        2. 7.2.2. Seeing your work in action
    4. 8. Putting Customers into Excel
      1. 8.1. Customizing Excel Workbooks
        1. 8.1.1. Getting to core Excel functions
        2. 8.1.2. Creating invoices in Excel
      2. 8.2. Working with the Action pane
      3. 8.3. Working with the Custom Task Pane
        1. 8.3.1. Adding real data
        2. 8.3.2. Binding VSTO controls
      4. 8.4. Using Excel Controls
        1. 8.4.1. Using the ListObject control to add data
        2. 8.4.2. Adding a few more columns
        3. 8.4.3. Displaying data on the worksheets
      5. 8.5. Working with Charts in Excel
        1. 8.5.1. Adding a chart the Excel way
        2. 8.5.2. Creating a chart from code
    5. 9. Presenting PowerPoint
      1. 9.1. Introducing PowerPoint
      2. 9.2. Changing the Way PowerPoint Runs
        1. 9.2.1. Working with individual panes
        2. 9.2.2. Altering a selected item
        3. 9.2.3. Making your selection
        4. 9.2.4. Looking at items different ways
      3. 9.3. Changing a Presentation Itself
        1. 9.3.1. Changing the design
        2. 9.3.2. Organizing the slides
        3. 9.3.3. Presenting the slide show
      4. 9.4. Changing Options
      5. 9.5. Using the Document Inspector
      6. 9.6. Adding to PowerPoint
      7. 9.7. An Example: Custom Art Selector
        1. 9.7.1. Creating a slide template
        2. 9.7.2. Building an add-in
          1. 9.7.2.1. Building an Image Library
          2. 9.7.2.2. Picking the images
          3. 9.7.2.3. Making a button on the Ribbon
        3. 9.7.3. Running the example
    6. 10. Building an Outlook Job Jar Add-in
      1. 10.1. Creating a Quick Example of an Outlook Add-in
      2. 10.2. Creating Outlook Items
        1. 10.2.1. Send me an e-mail
        2. 10.2.2. Got e-mail?
        3. 10.2.3. Oh, I got so much to do. . . .
      3. 10.3. Using Form Regions
        1. 10.3.1. Adding a new Form Region
        2. 10.3.2. Adding controls to the Designer
      4. 10.4. Building the Job Jar
        1. 10.4.1. Getting the requirements together
        2. 10.4.2. Writing code for your Job Jar
        3. 10.4.3. Setting up the user interface
        4. 10.4.4. Running the add-in
    7. 11. Creating a Project Project
      1. 11.1. Breaking Down the Object Model
        1. 11.1.1. Projects
        2. 11.1.2. Calendars
        3. 11.1.3. Resources
        4. 11.1.4. Tasks
      2. 11.2. Working Inside Project: An Example
      3. 11.3. Working with Server
        1. 11.3.1. Responding to events
    8. 12. Developing for Visio
      1. 12.1. Exploring Your Visio Development
        1. 12.1.1. Add-ons
        2. 12.1.2. VBA
        3. 12.1.3. COM add-ins
        4. 12.1.4. Shared add-ins
        5. 12.1.5. The Drawing Control
        6. 12.1.6. Visual Studio Tools for Office (VSTO)
      2. 12.2. Harnessing the Power of the Visio Model
        1. 12.2.1. Managing the document and pages
        2. 12.2.2. Adding basic shapes to a diagram
        3. 12.2.3. Adding neat shapes to a diagram
        4. 12.2.4. Putting type on the page
        5. 12.2.5. Making data connections
        6. 12.2.6. Saving and exporting the project
      3. 12.3. Getting Visualization into the Business Process
        1. 12.3.1. Getting data into that drawing
        2. 12.3.2. Making a subroutine to draw the store
        3. 12.3.3. Visualizing the product
        4. 12.3.4. Making a button in a toolbar
        5. 12.3.5. Running the example
  8. 3. Developing for SharePoint
    1. 13. Working with SharePoint
      1. 13.1. Getting Started with Microsoft SharePoint Foundation 2010
        1. 13.1.1. Preparing to install SharePoint 2010
        2. 13.1.2. Installing SharePoint prerequisites on Windows 7
        3. 13.1.3. Installing SharePoint
      2. 13.2. Working with SharePoint 2010 Projects in Visual Studio 2010
        1. 13.2.1. Exploring the SharePoint project structure
        2. 13.2.2. Taking a closer look at the Feature Designer
        3. 13.2.3. Looking at project items
        4. 13.2.4. Meeting the Package Designer
      3. 13.3. Deploying SharePoint Projects
    2. 14. Building SharePoint Workflows
      1. 14.1. Starting a Fresh Workflow
      2. 14.2. Knowing What You Have to Work With
      3. 14.3. Building a Simple Workflow
      4. 14.4. Setting the Workflow's Task Properties
      5. 14.5. Using a Workflow
      6. 14.6. Verifying Your Workflow
      7. 14.7. Starting the Workflow
      8. 14.8. Managing SharePoint Content Types
        1. 14.8.1. Adding a Content Type project
        2. 14.8.2. Adding columns
        3. 14.8.3. Referencing columns
        4. 14.8.4. Deploying the solution
    3. 15. Building SharePoint Lists and Libraries
      1. 15.1. Adding a List Definition to a Project
      2. 15.2. Changing the Startup Item
      3. 15.3. Uploading an Invoice to a Library
      4. 15.4. Adding Libraries to the Default View
      5. 15.5. Working with Visual Web Parts
        1. 15.5.1. Creating a visual Web part
        2. 15.5.2. Designing controls that work
        3. 15.5.3. Changing your solution type
        4. 15.5.4. Deploying your project
      6. 15.6. Deploying Files to SharePoint
      7. 15.7. Handling Events in SharePoint
        1. 15.7.1. Creating an event receiver
        2. 15.7.2. Adding an application page
        3. 15.7.3. Changing the event status
        4. 15.7.4. Deploying the event receiver
  9. 4. Finishing Up
    1. 16. Security
      1. 16.1. Checking Security with CAS
      2. 16.2. Creating Test Certificate Settings
      3. 16.3. Generating Manifests and the Trust Prompt
      4. 16.4. Office Trust Center
    2. 17. Deploying VSTO Solutions
      1. 17.1. Getting the Scoop on ClickOnce
      2. 17.2. Deploying an Add-In with ClickOnce
        1. 17.2.1. Adding a reference to the add-in project
        2. 17.2.2. Deploying the add-in
        3. 17.2.3. Finding additional deployment settings
        4. 17.2.4. Publishing your add-in
        5. 17.2.5. Updating and testing an add-in
      3. 17.3. Modifying Additional Settings
      4. 17.4. Troubleshooting
        1. 17.4.1. VSTO Developer Cleaner
        2. 17.4.2. VSTO Troubleshooter
  10. 5. The Part of Tens
    1. 18. Ten Reasons to Ditch Web Programming
      1. 18.1. Smart Clients Are Smarter!
      2. 18.2. Cross-Platform Needs Are (Often) Overstated
      3. 18.3. You Can Save Time and Money
      4. 18.4. People Already Know Office
      5. 18.5. You Can Offer Free Pops and Bangs
      6. 18.6. Composite Applications Are the Future
      7. 18.7. You Have No Cross-Browser Issues
      8. 18.8. New Deployment Features Reduce the Hosted Problem
      9. 18.9. You Can Combine Windows Forms Features with Your Programs
      10. 18.10. You Can Better Meet Your Customers Requirements
    2. 19. Ten Cool Ideas and Resources for Your Next VSTO Project
      1. 19.1. Create a Macro to Master the Object Model
        1. 19.1.1. Creating a macro
        2. 19.1.2. Working with your macro's code
      2. 19.2. Create Statistics in Outlook
      3. 19.3. Protect Your Privacy
      4. 19.4. Create a Four-in-a-Row Game
      5. 19.5. Search for Some URLs
      6. 19.6. Find Pictures for Your Presentations
      7. 19.7. Read Word Documents or E-Mails
      8. 19.8. Remember When Your Favorite Show Is On
      9. 19.9. Try to Make Your Own Treasure Map
      10. 19.10. Gather Up Resources for Office Developers
    3. 20. Ten Ways to Integrate SharePoint
      1. 20.1. Deploy Word or Excel Files with VSTO Automation to Document Libraries
      2. 20.2. Look at the SharePoint 2010 Object Model
      3. 20.3. Move Documents Around with a Workflow
      4. 20.4. Deploy InfoPath Forms to SharePoint
      5. 20.5. Integrate Security with a Claims-Based Identity Model
      6. 20.6. Build a PowerPoint Show from SharePoint Site Content
      7. 20.7. Use Excel Services in Your VSTO Applications (and Everywhere Else)
      8. 20.8. Index Your Documents
      9. 20.9. Remove Managed Code Extensions from Documents
      10. 20.10. Reference SharePoint Services in a VSTO Program