Visual Studio Tools for Office Using Visual Basic 2005 with Excel, Word, Outlook, and InfoPath

by ;
Edition: 1st
Format: Paperback
Pub. Date: 2006-04-26
Publisher(s): Addison-Wesley Professional
List Price: $54.99

Rent Book

Select for Price
There was a problem. Please try again later.

New Book

We're Sorry
Sold Out

Used Book

We're Sorry
Sold Out

eBook

We're Sorry
Not Available

How Marketplace Works:

  • This item is offered by an independent seller and not shipped from our warehouse
  • Item details like edition and cover design may differ from our description; see seller's comments before ordering.
  • Sellers much confirm and ship within two business days; otherwise, the order will be cancelled and refunded.
  • Marketplace purchases cannot be returned to eCampus.com. Contact the seller directly for inquiries; if no response within two days, contact customer service.
  • Additional shipping costs apply to Marketplace purchases. Review shipping costs at checkout.

Summary

"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 "This book covers in a clear and concise way all of the ins and outs of programming with Visual Studio Tools for Office. Given the AUTHORs' exhaustive experiences with this subject, you can't get a more AUTHORitative description of VSTO than this book!" -Paul Vick, technical lead, Visual Basic .NET, Microsoft Corporation "Eric and Eric 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, InfoPath, and Outlook solutions." -Vernon W. Hui, test lead, Microsoft Corporation "This book is an in-DEPTH, expert, and definitive guide to programming using Visual Studio Tools for Office 2005. 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 2003 using VSTO 2005,' but until you see something like the example at the start of Chapter 15, 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 2003." -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 2005. The DEPTH of their knowledge and understanding of VSTO and Office is evident in this book. Professional developers architecting enterprise solutions using VSTO 2005 and Office System 2003 now have a new weapon in their technical arsenal." -Paul Stubbs, program manager, 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 Visual Studio Tools for Office is both the first and the definitive book on VSTO 2005 programming, written by the inventors of the technology. VSTO is a set of tools that allows professional developers to use the full power of Visual Studio .NET and the .NET Framework to put code behind Excel 2003, Word 2003, Outlook 2003, and InfoPath 2003. VSTO provides functionality never before available to the Office developer: data binding and data/view separation, design-time views of Excel and Word documents inside Visual Studio, rich

Author Biography

Eric Carter is the development manager of the Visual Studio Tools for Office (VSTO) team at Microsoft

Table of Contents

Figuresp. xxxi
Tablesp. xlv
Forewordp. xlix
Prefacep. liii
Acknowledgmentsp. lvii
About the Authorsp. lix
An Introduction to VSTOp. 1
The Other Parts of This Bookp. 2
An Introduction to Office Programmingp. 3
Why Office Programming?p. 3
Office Object Modelsp. 6
Properties, Methods, and Eventsp. 12
The Office Primary Interop Assemblies (PIAs)p. 34
Conclusionp. 43
Introduction to Office Solutionsp. 45
The Three Basic Patterns of Office Solutionsp. 45
Office Automation Executablesp. 49
Office Add-Insp. 60
Code Behind a Documentp. 65
Conclusionp. 72
Office Programming in .NETp. 73
Programming Excelp. 75
Ways to Customize Excelp. 75
Programming User-Defined Functionsp. 83
Introduction to the Excel Object Modelp. 92
Conclusionp. 98
Working with Excel Eventsp. 99
Events in the Excel Object Modelp. 99
Events in Visual Studio 2005 Tools for Officep. 138
Conclusionp. 142
Working with Excel Objectsp. 143
Working with the Application Objectp. 143
Working with the Workbooks Collectionp. 157
Working with the Workbook Objectp. 161
Working with the Worksheets, Charts, and Sheets Collectionsp. 169
Working with Document Propertiesp. 172
Working with the Windows Collectionsp. 175
Working with the Window Objectp. 179
Working with the Names Collection and Name Objectp. 181
Working with the Worksheet Objectp. 183
Working with the Range Objectp. 197
Special Excel Issuesp. 213
Conclusionp. 220
Programming Wordp. 223
Ways to Customize Wordp. 223
Programming Research Servicesp. 229
Introduction to the Word Object Modelp. 237
Conclusionp. 238
Working with Word Eventsp. 243
Events in the Word Object Modelp. 243
Events in Visual Studio Tools for Officep. 273
Conclusionp. 275
Working with Word Objectsp. 277
Working with the Application Objectp. 277
Working with the Dialog Objectp. 299
Working with Windowsp. 304
Working with Templatesp. 307
Working with Documentsp. 310
Working with a Documentp. 315
Working with the Range Objectp. 335
Working with Bookmarksp. 358
Working with Tablesp. 360
Conclusionp. 362
Programming Outlookp. 363
Ways to Customize Outlookp. 363
Custom Property Pagesp. 370
Introduction to the Outlook Object Modelp. 378
Introduction to the Collaboration Data Objectsp. 382
Conclusionp. 386
Working with Outlook Eventsp. 387
Events in the Outlook Object Modelp. 387
Application-Level Eventsp. 392
Outlook Item Eventsp. 405
Other Eventsp. 419
Conclusionp. 422
Working with Outlook Objectsp. 423
Working with the Application Objectp. 423
Working with the Explorers and Inspectors Collectionsp. 431
Working with the Explorer Objectp. 433
Working with the Inspector Objectp. 440
Working with the NameSpace Objectp. 443
Working with the MAPIFolder Objectp. 450
Working with the Items Collectionp. 459
Properties and Methods Common to Outlook Itemsp. 466
Outlook Issuesp. 486
Conclusionp. 492
Introduction to InfoPathp. 493
What Is InfoPath?p. 493
Getting Startedp. 494
Form Securityp. 499
Programming InfoPathp. 505
Data Source Eventsp. 509
Form Events, Properties, and Methodsp. 518
Conclusionp. 529
Office Programming in VSTOp. 531
The VSTO Programming Modelp. 533
The VSTO Programming Modelp. 533
VSTO Extensions to Word and Excel Objectsp. 536
Dynamic Controlsp. 542
Inspecting the Generated Codep. 549
VSTO Extensions to the Word and Excel Object Modelsp. 555
Conclusionp. 569
Using Windows Forms in VSTOp. 571
Introductionp. 571
Adding Windows Forms Controls to Your Documentp. 577
Writing Code Behind a Controlp. 584
The Windows Forms Control Hosting Architecturep. 585
Properties Merged from OLEObject or OLEControlp. 594
Adding Controls at Runtimep. 597
Conclusionp. 605
Working with the Actions Panep. 607
Introduction to the Actions Panep. 607
Working with the ActionsPane Controlp. 613
Conclusionp. 628
Working with Smart Tags in VSTOp. 629
Introduction to Smart Tagsp. 629
Creating Document-Level Smart Tags with VSTOp. 633
Creating Application-Level Smart Tagsp. 647
Conclusionp. 672
VSTO Data Programmingp. 673
Creating a Data-Bound Customized Spreadsheet with VSTOp. 673
Creating a Data-Bound Customized Word Document with VSTOp. 681
Datasets, Adapters, and Sourcesp. 682
Another Technique for Creating Data-Bound Spreadsheetsp. 691
Caching Data in the Data Islandp. 699
Advanced ADO.NET Data Binding: Looking Behind the Scenesp. 704
Binding-Related Extensions to Host Items and Host Controlsp. 705
Conclusionp. 712
Server Data Scenariosp. 713
Populating a Document with Data on the Serverp. 713
Using ServerDocument and ASP.NETp. 716
A Handy Client-Side ServerDocument Utilityp. 724
The ServerDocument Object Modelp. 726
Conclusionp. 737
.NET Code Securityp. 739
Code-Access Security Versus Role-Based Securityp. 740
Code-Access Security in .NETp. 741
Location, Location, Locationp. 749
Strong Namesp. 753
Publisher Certificatesp. 761
Trusting the Documentp. 765
Deploying Policy to User Machinesp. 769
Conclusionp. 773
Deploymentp. 775
VSTO Prerequisitesp. 776
Deploying to an Intranet Shared Directory or Web Sitep. 777
Local Machine Deployment Without a Deployment Manifestp. 785
Editing Manifestsp. 787
Creating Setup Packagesp. 793
Conclusionp. 805
Advanced Office Programmingp. 807
Working with XML in Excelp. 809
Introduction to Excel's XML Featuresp. 809
Introduction to XML Schema Creation in Visual Studiop. 811
An End-to-End Scenariop. 816
Advanced XML Features in Excelp. 826
Excel-Friendly XML Schemasp. 830
VSTO Support for Excel Schema Mappingp. 833
Conclusionp. 849
Working with XML in Wordp. 851
Introduction to Word's XML Featuresp. 851
An End-to-End Scenario: Creating a Schema and Mapping It into a Word Documentp. 855
Exporting the Mapped XML in the Document to an XML Data Filep. 869
Importing an XML Data File into the Mapped Documentp. 871
The XML Options Dialog Boxp. 877
VSTO Support for Word Schema Mappingp. 880
VSTO Support for the WordML File Formatp. 888
Conclusionp. 889
Developing COM Add-Ins for Word and Excelp. 891
Introduction to Add-Insp. 891
Scenarios for Using Add-Insp. 892
How a COM Add-In Is Registeredp. 893
Implementing IDTExtensibility2p. 897
Writing a COM Add-In Using Visual Studiop. 904
The Pitfalls of mscoree.dllp. 914
COM Interop and regasm.exep. 914
Shimming: A Solution to the Problems with mscoree.dllp. 919
Conclusionp. 920
Creating Outlook Add-Ins with VSTOp. 921
Moving Away from COM Add-Insp. 921
Creating an Outlook Add-In in VSTOp. 933
Conclusionp. 940
Bibliographyp. 941
Indexp. 943
Table of Contents provided by Ingram. All Rights Reserved.

Excerpts

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 to not only combine the richness of the new .NET Framework and developer tools with the powerful platform that Office has always provided for developers, but also 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 2005 and C#. It solved the problem of embedded code by linking a document to a .NET assembly instead of embedding the .NET assembly 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 2005the version of VSTO covered by this bookis even more ambitious. It brings with it functionality never before available to the Office developer, 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 Officeand 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. This book tries to put into one place all the information you need to succeed using VSTO to program against Word 2003, Excel 2003, Outlook 2003, and InfoPath 2003. It introduces the Office object models and covers the most commonly used objects in those object models. In addition, this book will help you avoid some pitfalls that result from the COM origins of the Office object models. (Complete Visual Basic 2005 code samples are available on the book's Web page at

An electronic version of this book is available through VitalSource.

This book is viewable on PC, Mac, iPhone, iPad, iPod Touch, and most smartphones.

By purchasing, you will be able to view this book online, as well as download it, for the chosen number of days.

Digital License

You are licensing a digital product for a set duration. Durations are set forth in the product description, with "Lifetime" typically meaning five (5) years of online access and permanent download to a supported device. All licenses are non-transferable.

More details can be found here.

A downloadable version of this book is available through the eCampus Reader or compatible Adobe readers.

Applications are available on iOS, Android, PC, Mac, and Windows Mobile platforms.

Please view the compatibility matrix prior to purchase.