VSTO 3.0 for Office 2007 Programming
eBook - ePub

VSTO 3.0 for Office 2007 Programming

  1. 260 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

VSTO 3.0 for Office 2007 Programming

About this book

In Detail

With the arrival of Visual Studio Tools for Office 3.0 (VSTO), developers can now program Microsoft Office from the .NET framework. There are huge books in the market that give loads of unnecessary information but are of no real help to brand-new Office developers. Wouldn't it be great to have a precise book that simply covers the basics and introduces programming Office 2007 with VSTO using the latest version of Visual Studio? This is that book.

VSTO 3.0 for Office 2007 Programming shows you how to write Office 2007 applications with Visual Studio Tools for Office 3.0. Learn how to automate tasks in InfoPath, Word, Excel, Outlook, PowerPoint, Visio, and Project 2007 with greater programming power and flexibility than was available from the VBA language. With this book and the mastery of VSTO you will learn, Office will no longer be an application to you; it will be a platform for developing custom applications.

VSTO 3 is the most recent version of VSTO, making use of Visual Studio 2008, and working with Office 2007. This book shows how VSTO puts Office automation into the hands of developers, allowing them to use the power of the .NET framework to automate Office applications thus increasing the speed of the applications, their security, and the opportunity to use other parts of the .NET Framework such as its data handling capabilities.

This book builds a solid programming foundation in VSTO for brand-new Office developers. You will leave behind the world of VBA programming and take your first steps into the powerful and exciting world of using C# to create Office 2007 applications. Packed with examples and covering all the main Office applications, this book will have you creating fully featured Office extensions before you know it.

A step-by-step guide for brand-new Office developers who want to explore programming with VSTO

Approach

This book contains complete step-by-step instructions and simple explanations about VSTO programming of entire Office applications. It covers the concepts of VSTO, VSTO architecture, its features, and versions using practical examples, to help beginners and intermediate developers develop real-world Office applications. Separate chapters cover programming InfoPath, Word, Excel, Outlook, and PowerPoint.

Who this book is for

This book is aimed at .NET developers, familiar with C#, who want to get to grips with programming Office 2007. The book will also be useful for those of you who already have experience with VBA and programming Office, but are ready to take the next step into the more powerful world of Office programming with VSTO.

Trusted by 375,005 students

Access to over 1 million titles for a fair monthly price.

Study more efficiently using our study tools.

Information

VSTO 3.0 for Office 2007 Programming

Vivek Thangaswamy


Table of Contents

VSTO 3.0 for Office 2007 Programming
Credits
About the Author
About the Reviewers
Preface
What this book covers
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code for the book
Errata
Piracy
Questions
1. Visual Studio Tools for Office (VSTO)
What is Microsoft VSTO?
Why VSTO 3.0?
Safer managed code extensions
Data caching
Feature customization
User Interface customization
Smart tags
WPF support
Visual designers
Security improvements
Maintainability
What's new in VSTO 3.0?
VSTO architecture
Development approaches
Document-oriented approach
Application-oriented approach
VSTO development and deployment
Creating Office applications through VSTO
VSTO development environment
Package
Visual Studio integration
Creating VSTO solutions
Viewing IDE Windows
Debugging
What can we expect in the next version?
Summary
2. Microsoft Office InfoPath Programming
Microsoft Office InfoPath
InfoPath 2007 in Visual Studio
Visual Studio 2008 InfoPath solution overview
The VSTO problem when installing Office InfoPath 2007
Creating our first example
Available customization features
Data validation
Custom actions on save
Switching views
Object model in InfoPath solution
Understanding the Microsoft Office InfoPath object model
Understanding the InfoPath object model functional area
Application
WindowCollection
Window
XmlFormCollection
XmlForm
View
ViewInfoCollection
Using events in InfoPath
Form-level events
An example of the solution xsi:nil="true" attribute
Loading event
Using the ViewSwitched event
Using the ContextChanged event
Using the Submit event
Using the VersionUpgrade event
Using the Save event
Sign event
Merge event
Xml events
Changed event
Changing event
Validating event
Control events
Clicked event
Writing event validation for an expense report form
Manipulating a data source
Fetch node value from main data source
Assigning a value to a node in the main data source
Adding or creating a new node in the main data source
Deleting or removing nodes from the main data source
Populating Microsoft Office InfoPath with Microsoft SQL Server 2008
Working with Custom Task Panes
Managed code
Custom Task Pane
Creating an InfoPath Task Pane
Creating an InfoPath add-in project using Visual Studio 2008
InfoPath and SharePoint workflow
Summary
3. Microsoft Office Word Programming
Microsoft Office Word 2007 solutions
Application-level solutions versus document-level solutions
Creating document-level solutions
Publishing solution deployment
Working with objects and documents
Application object
Document object
Range object
Selection object
Tables collection object
Working with key objects
Inserting text in Word 2007 document
Selecting text in a Word 2007 document
Creating a table in a Word 2007 document
Working with Word templates
Actions Pane: Document-level customization
Creating a Custom Actions Pane for Microsoft Office Word 2007
Managing the Actions Pane
Designing the Actions Pane
Application-level solutions
Task Pane: Application-level customization
What is the Task Pane?
Custom Task Pane
Creating a Custom Task Pane for Microsoft Office Word 2007
Programming in Word
Word host items
Word host controls
Adding controls to a document
Adding an ActiveX control to Microsoft Office Word 2007 programmatically
Data binding to host controls
Simple data binding
Complex data binding
What is LINQ?
Using LINQ in Word 2007 with VSTO 3.0 and Visual Studio 2008
Customization
Ribbon menu
Adding controls to menus
Toolbar (Quick Access Toolbar)
Adding controls to toolbars
Summary
4. Microsoft Office Excel Programming
Programming in Excel
Hello World example using Visual Studio 2008
Manipulation
Data manipulation
Reading worksheet cells
Opening a text file as a workbook using VSTO
Connecting with Microsoft SQL Server 2008 database
Worksheet manipulation
Working with ranges
Cells
Unions
Named ranges
Excel host items
The workbook host item
The worksheet host item
The ChartSheet host item
Excel host controls
Chart control
The ListObject control
The NamedRange control
The XMLMappedRange control
The SelectionChange event
Creating Excel smart tags with VSTO
Excel formulae
Regular expressions
Excel data protection
Workbook protection
Worksheet protection
Summary
5. Microsoft Office Outlook Programming
Microsoft Office Outlook object model overview
Customization using VSTO
Menus in Outlook
Toolbars in Outlook
Outlook form regions support
Manipulation
Folders
Contacts
Email messages
Working with Appointments
Working with meetings
Creating a Ribbon menu for Outlook 2007
Outlook 2007 data interaction with Microsoft SQL Server 2008
Summary
6. Microsoft Office PowerPoint, Visio, and Project Programming
Programming PowerPoint 2007
PowerPoint 2007 object model
Creating a presentation at runtime
Dynamically add a slide and set title text in the presentation
Set the presentation theme
Ribbons in PowerPoint
Ribbon Visual Designer
Creating a Ribbon
Programming Visio 2007
Visio 2007 object model
Dynamically creating a new Visio document
Adding shapes to a document at runtime
Adding a page as a background for another page
Set the document theme
Creating a Commandbar
Programming Project 2007
Creating a Project and adding a task dynamically
Creating menus for Microsoft Project
Creating a Commandbar for Microsoft Project
Summary
Index

VSTO 3.0 for Office 2007 Programming

Copyright © 2009 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold ithout warranty, either express or implied. Neither the author, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: March 2009
Production Reference: 1040309
Published by Packt Publishing Ltd.
32 Lincoln Road
Olton,
Birmingham, B27 6PA, UK.
ISBN 978-1-847197-52-8
www.packtpub.com
Cover Image by Parag Kadam ()

Credits

Author
Vivek Thangaswamy
Reviewers
Helmut Obertanner
Maarten van Stam
N Satheesh Kumar
Senior Acquisition Editor
Douglas Paterson
Development Editor
Dilip Venkatesh
Technical Editor
Rakesh Shejwal
Copy Editor
Sumathi Sridhar
Indexer
Monica Ajmera
Production Editorial...

Table of contents

  1. VSTO 3.0 for Office 2007 Programming

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access VSTO 3.0 for Office 2007 Programming by Vivek Thangaswamy in PDF and/or ePUB format, as well as other popular books in Computer Science & Information Technology. We have over one million books available in our catalogue for you to explore.