HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
Visual Studio Tools for Office 2007: VSTO for Excel, Word, and Outlook is the definitive book on VSTO 2008 programming, written by the inventors of the technology. VSTO is a set of tools that allows professional developers to use the full power of Microsoft Visual Studio 2008 and the .NET Framework to program against Microsoft Office 2007.
This book delivers in one place all the information you need to succeed using VSTO to program against Word 2007, Excel 2007, and Outlook 2007, and provides the necessary background to customize Visio 2007, Publisher 2007, and PowerPoint 2007. It introduces the Office 2007 object models, covers the most commonly used objects in those object models, and will help you avoid the pitfalls caused by the COM origins of the Office object models. Developers who wish to program against Office 2003 should consult Carter and Lippert’s previous book, Visual Studio Tools for Office.
In VSTO 2008, you can build add-ins for all the major Office 2007 applications, build application-level custom task panes, customize the new Office Ribbon, modify Outlook’s user interface using Form Regions, and easily deploy everything you build using ClickOnce.
Carter and Lippert cover their subject matter with deft insight into the needs of .NET developers learning VSTO, based on the deep knowledge that comes from the authors’ unique perspective of living and breathing VSTO for the past six years. This book
This is the one book you need to succeed in programming against Office 2007.
C# and Visual Basic .NET Code samples for download can be found here: http://www.informit.com/store/product.aspx?isbn=0321533216
Figures xxxi
Tables xlv
Foreword li
Preface lv
Acknowledgments lix
About the Authors lxi
Part I: An Introduction to VSTO 1
Chapter 1: An Introduction to Office Programming 3
Why Office Programming? 3
Office Business Applications 3
Office Object Models 7
Properties, Methods, and Events 14
The Office Primary Interop Assemblies (PIAs) 39
Conclusion 48
Chapter 2: Introduction to Office Solutions 51
The Three Basic Patterns of Office Solutions 51
Office Automation Executables 54
Office Add-Ins 69
Code Behind a Document 78
Conclusion 86
Part II: Office Programming in .NET 87
Chapter 3: Programming Excel 89
Ways to Customize Excel 89
Programming User-Defined Functions 98
Introduction to the Excel Object Model 108
Conclusion 112
Chapter 4: Working with Excel Events 115
Events in the Excel Object Model 115
Conclusion 162
Chapter 5: Working with Excel Objects 163
Working with the Application Object 163
Working with the Workbooks Collection 178
Working with the Workbook Object 181
Working with the Worksheets, Charts,
Working with Document Properties 192
Working with the Windows Collections 195
Working with the Window Object 199
Working with the Names Collection and Name Object 202
Working with the Worksheet Object 204
Working with the Range Object 219
Special Excel Issues 235
Conclusion 241
Chapter 6: Programming Word 243
Ways to Customize Word 243
Programming Research Services 249
Introduction to the Word Object Model 261
Conclusion 262
Chapter 7: Working with Word Events 267
Events in the Word Object Model 267
Events in Visual Studio Tools for Office 307
Conclusion 310
Chapter 8: Working with Word Objects 311
Working with the Application Object 311
Working with the Dialog Object 332
Working with Windows 338
Working with Templates 341
Working with Documents 343
Working with a Document 348
Working with the Range Object 369
Working with Bookmarks 392
Working with Tables 394
Working with Content Controls 396
Conclusion 403
Chapter 9: Programming Outlook 405
Ways to Customize Outlook 405
Introduction to the Outlook Object Model 419
Conclusion 422
Chapter 10: Working with Outlook Events 425
Events in the Outlook Object Model 425
Application-Level Events 427
Outlook Item Events 448
Other Events 470
Conclusion 473
Chapter 11: Working with Outlook Objects 475
Working with the Application Object 475
Working with the Explorers and Inspectors Collections 486
Working with the Explorer Object 488
Working with the Inspector Object 501
Working with the NameSpace Object 506
Working with the Folder Object 519
Working with the Items Collection 534
Properties and Methods Common to Outlook Items 548
Conclusion 569
Part III: Office Programming in VSTO 571
Chapter 12: The VSTO Programming Model 573
The VSTO Programming Model for Documents 573
VSTO Extensions to Word and Excel Document Objects 576
Dynamic Controls in the Document 584
Advanced Topic: Class Hookup and Cookies 591
Advanced Topic: Inspecting the Generated Code 594
VSTO Extensions to the Word and Excel Object Models 599
The VSTO Programming Model for Add-Ins 619
Using VSTO Document Features in Application-Level Add-Ins 621
Advanced Topic: Creating Worksheets Dynamically 624
Conclusion 625
Chapter 13: Using Windows Forms and WPF in VSTO 627
Introduction 627
Adding Windows Forms Controls to Your Document 634
Writing Code Behind a Control 641
The Windows Forms Control Hosting Architecture 643
Properties Merged from OLEObject or OLEControl 654
Adding Controls at Runtime 658
Using WPF Controls in the Document 669
Conclusion 671
Chapter 14: Working with Document-Level Actions Panes 673
Introduction to the Document Actions Task Pane 673
Working with the ActionsPane Control 680
Using WPF Controls in an Actions Pane 697
Conclusion 699
Chapter 15: Working with Application-Level Custom Task Panes 701
Introduction to the Application-Level Custom Task Panes 701
Working with Custom Task Panes 704
Custom Task Panes and Application Windows 710
Using WPF Controls in a Custom Task Pane 719
Conclusion 722
Chapter 16: Working with Outlook Form Regions 723
Introduction to Form Regions 723
Form Region Types and Custom Message Classes 743
Creating an Outlook Forms-Based Form Region 749
Outlook Form Region Programmability 765
Conclusion 774
Chapter 17: Working with the Ribbon in VSTO 777
Introduction to the Office Ribbon 777
Working with the Ribbon in the Ribbon Designer 800
Creating a Ribbon in an Excel Workbook Project 812
Creating a Ribbon in an Outlook Add-In Project 825
Advanced Ribbon Topics 836
Conclusion 850
Chapter 18: Working with Smart Tags in VSTO 851
Introduction to Smart Tags 851
Creating Document-Level Smart Tags with VSTO 855
Creating Application-Level Smart Tags 874
Conclusion 880
Chapter 19: VSTO Data Programming 881
Creating a Data-Bound Customized Spreadsheet with VSTO 882
Creating a Data-Bound Customized Word Document with VSTO 889
Datasets, Adapters, and Sources 891
Another Technique for Creating Data-Bound Documents 901
Caching Data in the Data Island 908
Advanced Topic: Using ICachedType 911
Advanced ADO.NET Data Binding: Looking Behind the Scenes 913
Binding-Related Extensions to Host Items and Host Controls 914
Using Data Binding and Dynamic Controls from an Application-Level Add-In 921
Conclusion 928
Chapter 20: Server Data Scenarios 929
Populating a Document with Data on the Server 929
Using ServerDocument and ASP.NET 931
A Handy Client-Side ServerDocument Utility 939
The ServerDocument Object Model 941
Conclusion 952
Chapter 21: ClickOnce Deployment 955
Introduction 955
Prerequisites 956
Deploying Add-Ins 958
Deploying Document Solutions 982
ClickOnce Security 995
Other Deployment Scenarios 1009
Advanced Topic: Editing Manifests Using Mage 1010
Conclusion 1015
Bibliography 1017
Index 1019