Book Image

VSTO 3.0 for Office 2007 Programming

By : Vivek Thangaswamy
Book Image

VSTO 3.0 for Office 2007 Programming

By: Vivek Thangaswamy

Overview of this book

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.
Table of Contents (11 chapters)
VSTO 3.0 for Office 2007 Programming
Credits
About the Author
About the Reviewers
Preface

Preface

Welcome to VSTO 3.0 for Office 2007 Programming. This book covers Visual Studio Tools for Office programming, with a primary emphasis on the several new VSTO programming features available for Microsoft Office 2007. VSTO is a phenomenon that means different things to different people. This book introduces developers to VSTO as a platform for developing enterprise solutions based on Microsoft Office application.

This book covers Microsoft VSTO objects for Microsoft Office applications such as Word, Excel, PowerPoint, Visio, Outlook, and Project, which can be a significant challenge for the typical VBA developer—one set of target readers for this book. This book is focused more on the features of VSTO and how to work with the heavily-built Office object models. Although you might not be familiar with .NET programming, this book will help you to adapt easily to the new VSTO with .NET programming environment.

VSTO brings the Office applications to the .NET programming world. With VSTO 3.0, you can create add-ins for the six Microsoft Office applications, customize the Ribbon feature of the Microsoft Office 2007 suite, and create application-level custom task panes. This book strives to follow the same model. It explains VSTO’s concepts and basic programming in a way that helps beginners to get started and helps advanced users to get better. In addition to this, the book includes chapters for all of the Office applications, which describe how the programming and customization works, what its requirements are, and how it will simplify typical tasks.

What this book covers

Chapter 1 provides a panoramic overview of Visual Studio Tools for Office. This chapter provides you with a firm grounding in what VSTO really is. We look at how VSTO addresses the Microsoft Office 2007 customization area, its feature set, and its architecture.

Chapter 2 starts by explaining the object model and programming approach in InfoPath 2007. We then take a look at how we can customize InfoPath with Visual Studio 2008. The later part of the chapter explains how to work on task pane creation, development of add-ins, and so on.

Chapter 3 begins with a description of creating a Word solution using Visual Studio 2008, and as we move further, the chapter explains how to create document-level solutions and application-level solutions. It then explains the deployment process. It also covers key Word objects, with examples of how to work with SQL data manipulation, and so on.

Chapter 4 takes a look at working with Excel objects, and covers key objects with example solutions. It focuses on explaining host items and host controls and provides examples of some common solutions. It also gives you an idea of worksheet protection, smart tags, charts, and so on, with the help of examples.

Chapter 5 starts the chapter with an overview of Outlook objects and moves on to Outlook folder manipulation, mail item processing and working with meetings and appointments. In the later part of the chapter, we work with Ribbon customization for Outlook, with examples and many such customizations for Outlook.

Chapter 6 covers three Office applications: PowerPoint, Visio, and Project. Here, we work with shapes in Visio, Ribbon customization for PowerPoint, and dynamic project item manipulation, and so on.

Who this book is for

This book is aimed at .NET developers who are familiar with C# and who want to get to grips with programming Office 2007. The book will also be useful for people 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.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Zack used the AfterNewPresentation event and developed a solution for it".

A block of code will be set as follows:

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
// Creating PowerPoint presentation with single slide in it
// Using the PowerPoint object instance adding the
// Slide with text title structure to the current Presentation
PowerPoint.Presentation PacktPresentation = this.Application. Presentations.Add(Microsoft.Office.Core.MsoTriState. msoTriStateMixed);
}

New terms and important words are introduced in a bold-type font. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: "As it can be seen in the following screenshot, Say Hello World is displayed in a message box:".

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an email to , making sure that you mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note via the SUGGEST A TITLE form on www.packtpub.com, or send an email to .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book on, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code for the book

Visit http://www.packtpub.com/files/code/7528_Code.zip to directly download the example code.

Errata

Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing this you can save other readers from frustration, and help to improve subsequent versions of this book. If you find any errata, report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to any list of existing errata. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide the location address or website name immediately, so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of this book, and we will do our best to address it.