“Visual Studio Tools for Office has always been one of my favorite technologies to come out of Microsoft. There are millions of people who use Office applications all day, every day; with VSTO, you can create applications for them. Eric Carter and Eric Lippert helped create VSTO, so they know as much about it as anybody, making this book a must-have. After reading it, you’ll know everything needed to begin building solutions that take advantage of the .NET Framework features, in the UI your users are familiar with.”
–Robert Green, senior consultant, MCW Technologies
“With the application development community so focused on the Smart Client revolution, a book that covers VSTO from A to Z is both important and necessary. This book lives up to big expectations. It is thorough, has tons of example code, and covers Office programming in general terms–topics that can be foreign to the seasoned .NET developer who has focused on ASP.NET applications for years. Congratulations to Eric Lippert and Eric Carter for such a valuable work!”
–Tim Huckaby, CEO, InterKnowlogy; Microsoft Regional Director
“Eric Carter and Eric Lippert really get it. Professional programmers will love the rich power of Visual Studio and .NET, along with the ability to tap into Office programmability. This book walks you through programming Excel, Word, and Outlook solutions.”
–Vernon W. Hui, test lead, Microsoft Corporation
“This book is both a learning tool and a reference book, with a richness of tables containing object model objects and their properties, methods, and events. I would recommend it to anyone considering doing Office development using the .NET Framework; especially people interested in VSTO programming.”
–Rufus Littlefield, software design engineer/tester, Microsoft Corporation
“This book will help Office .NET Developers optimize their work. It goes beyond providing an introduction to VSTO and the object models of Word, Excel, and Outlook. The overview of other technologies available for interacting with Office assist in analyzing how to best approach any Office project. In addition, the authors’ insights into the design of this RAD tool make it possible to get the most out of VSTO applications.”
–Cindy Meister, Microsoft MVP for VSTO, author of Word Programmierung, Das Handbuch
“This book is an in-depth, expert, and definitive guide to programming using Visual Studio Tools for Office 2007. It is a must-have book for anyone doing Office development.”
–Siew Moi Khor, programmer/writer, Microsoft Corporation
“We don’t buy technical books for light reading, we buy them as a resource for developing a solution. This book is an excellent resource for someone getting started with Smart Client development. For example, it is common to hear a comment along the lines of, ‘It is easy to manipulate the Task Pane in Office 2007 using VSTO 2008,’ but until you see something like the example at the start of Chapter 14, it is hard to put ‘easy’ into perspective.
“This is a thorough book that covers everything from calling Office applications from your application, to building applications that are Smart Documents. It allows the traditional Windows developer to really leverage the power of Office 2007.”
–Bill Sheldon, principal engineer, InterKnowlogy; MVP
“Eric Carter and Eric Lippert have been the driving force behind Office development and Visual Studio Tools for Office. The depth of their knowledge and understanding of VSTO and Office is evident in this book. Professional developers architecting enterprise solutions using VSTO 2008 and Office system 2007 now have a new weapon in their technical arsenal.”
–Paul Stubbs, program manager, Microsoft Corporation
“This book, also known as ‘The Bible of VSTO,’ has been rewritten for Office 2007 and I was delighted to read the sections on new VSTO features that were added in Visual Studio 2008. It explains how the VSTO team hid the plumbing and cumbersome coding tasks to allow you to be more productive and to just create excellent business applications. New or experienced in Office development, you will want to add this book to your library!”
–Maarten van Stam, Microsoft MVP, Visual Developer, VSTO, http://blogs.officezealot.com/maarten
“This book covers all of the ins and outs of programming with Visual Studio Tools for Office in a clear and concise way. Given the authors’ exhaustive experiences with this subject, you can’t get a more authoritative description of VSTO than this book!”
–Paul Vick, principal architect, Microsoft Corporation
About the Author
Eric Carter is a development manager on the Visual Studio team at Microsoft. He helped invent, design, and implement many of the features that are in VSTO today. Previously at Microsoft he worked on Visual Studio for Applications, the Visual Studio Macros IDE, and Visual Basic for Applications for Office 2000 and Office 2003.
Eric Lippert’s primary focus during his twelve years at Microsoft has been on improving the lives of developers by designing and implementing useful programming languages and development tools. He has worked on the Windows Scripting family of technologies, Visual Studio Tools for Office, and, most recently, on the C# compiler team.
Excerpt. © Reprinted by permission. All rights reserved.
In 2002 the first release of Visual Studio .NET and the .NET Framework was nearing completion. A few of us at Microsoft realized that Office programming was going to miss the .NET wave unless we did something about it.
What had come before was Visual Basic for Applications (VBA), a simple development environment integrated into all the Office applications. Each Office application had a rich object model that was accessed via a technology known as COM. Millions of developers identified themselves as “Office developers” and used VBA and the Office COM object models to do everything from automating repetitive tasks to creating complete business solutions that leveraged the rich features and user interface of Office. These developers realized that their users were spending their days in Office. By building solutions that ran inside Office, they not only made their users happy, but also were able to create solutions that did more and cost less by reusing functionality already available in the Office applications.
Unfortunately, because of some limitations of VBA, Office programming was starting to get a bad rap. Solutions developed in VBA by small workgroups or individuals would gain momentum, and a professional developer would have to take them over and start supporting them. To a professional developer, the VBA environment felt simple and limited, and of course, it enforced a single language: Visual Basic. VBA embedded code in every customized document, which made it hard to fix bugs and update solutions because a bug would get replicated in documents across the enterprise. Security weaknesses in the VBA model led to a rash of worms and macro viruses that made enterprises turn VBA off.
Visual Studio .NET and the .NET Framework provided a way to address all these problems. A huge opportunity existed not only to combine the richness of the new .NET Framework and developer tools with the powerful platform that Office has always provided for developers, but also to solve the problems that were plaguing VBA. The result of this realization was Visual Studio Tools for Office (VSTO).
The first version of VSTO was simple, but it accomplished the key goal of letting professional developers use the full power of Visual Studio .NET and the .NET Framework to put code behind Excel 2003 and Word 2003 documents and templates. It let professional developers develop Office solutions in Visual Basic and C#. It solved the problem of embedded code by linking a document to a .NET assembly instead of embedding it in the document. It also introduced a new security model that used .NET code-access security to prevent worms and macro viruses.
The second version of VSTO, known as VSTO 2005, was even more ambitious. It brought with it functionality never available to the Office developer before, such as data binding and data/view separation, design-time views of Excel and Word documents inside Visual Studio, rich support for Windows Forms controls in the document, the ability to create custom Office task panes, server-side programming support against Office—and that’s just scratching the surface. Although the primary target of VSTO is the professional developer, that does not mean that building an Office solution with VSTO is rocket science. VSTO makes it possible to create very rich applications with just a few lines of code.
The third version of VSTO, which this book focuses on, shipped as a core feature of Visual Studio 2008. It is sometimes said that it takes Microsoft three versions to get something right, and we truly feel that this version of VSTO has the most amazing support for Office programming that Microsoft has ever built. In VSTO, you can now build add-ins for all the major Office applications; you can build application-level custom task panes; you can customize the new Office Ribbon; you can modify Outlook’s UI using Forms Regions, and you can easily deploy everything you build using ClickOnce. The Office 2007 applications themselves are more extensible and provide many new programmability features.
If you’ve been reluctant to use VSTO because of the issues in previous versions—such as the difficulty of deployment, the nonsupport of VSTO in the Visual Studio Professional SKU, and the limited support for add-ins—we’re happy to tell you that these issues have been fixed in the third version of VSTO.
This book tries to put in one place all the information you need to succeed using VSTO to program against Word 2007, Excel 2007, and Outlook 2007. It introduces the Office 2007 object models and covers the most commonly used objects in those object models. In addition, this book helps you avoid some pitfalls that result from the COM origins of the Office object models. This book also provides necessary backround for developers using VSTO to customize Visio 2007, Publisher 2007, PowerPoint 2007, and InfoPath 2007. Although it doesn’t specifically focus on these applications, it teaches how to use the VSTO add-in model, how to create custom task panes and ribbons, and how to code against Office object models using C#.
This book also provides an insider view of all the rich features of VSTO. We participated in the design and implementation of many of these features; therefore, we can speak from the unique perspective of living and breathing VSTO for the past six years. Programming Office using VSTO is powerful and fun. We hope you enjoy using VSTO as much as we enjoyed writing about it and creating it.
© Copyright Pearson Education. All rights reserved.