Visual Studio Tools for Office: Using Visual Basic 2005 with Excel, Word, Outlook, and InfoPath
暫譯: Visual Studio Office 工具:使用 Visual Basic 2005 與 Excel、Word、Outlook 和 InfoPath
Eric Carter, Eric Lippert
- 出版商: Addison Wesley
- 出版日期: 2006-04-01
- 售價: $2,440
- 貴賓價: 9.5 折 $2,318
- 語言: 英文
- 頁數: 1056
- 裝訂: Paperback
- ISBN: 0321411757
- ISBN-13: 9780321411754
-
相關分類:
Excel、Visual Basic、Visual Studio
已絕版
買這商品的人也買了...
-
$680$537 -
$880$695 -
$650$507 -
$780$663 -
$680$537 -
$520$411 -
$620$490 -
$650$507 -
$680$537 -
$550$435 -
$980$774 -
$1,080CMMI: Guidelines for Process Integration and Product Improvement, 2/e
-
$520$411 -
$750$593 -
$880$695 -
$750$593 -
$680$537 -
$450$356 -
$780$616 -
$720$569 -
$1,200$948 -
$990UML 2 Certification Guide: Fundamental & Intermediate Exams (Paperback)
-
$880$695 -
$620$490 -
$600$480
商品描述
Description
“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 CorporationVisual 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 support for Windows Forms controls in a document, the ability to create custom Office task panes, server-side programming support against Office, and much more.
Carter and Lippert cover their subject matter with deft insight into the needs of .NET developers learning VSTO. This book
- Explains the architecture of Microsoft Office programming and introduces the object models
- Teaches the three basic patterns of Office solutions: Office automation executables, Office add-ins, and code behind a document
- Explores the ways of customizing Excel, Word, Outlook, and InfoPath, and plumbs the depths of programming with their events and object models
- Introduces the VSTO programming model
- Teaches how to use Windows Forms in VSTO and how to work with the Actions Pane
- Delves into VSTO data programming and server data scenarios
- Explores .NET code security and VSTO deployment
Advanced material covers working with XML in Word and Excel, developing COM add-ins for Word and Excel, and creating Outlook add-ins with VSTO.
The complete code samples are available on the book’s Web page.
Table of Contents
Figures xxxiTables xlvForeword xlixPreface liiiAcknowledgments lviiAbout the Authors lixPart I: An Introduction to VSTO 1Chapter 1: An Introduction to Office Programming 3
Why Office Programming? 3
Office Object Models 6
Properties, Methods, and Events 12
The Office Primary Interop Assemblies (PIAs) 34
Conclusion 43
Chapter 2: Introduction to Office Solutions 45
The Three Basic Patterns of Office Solutions 45
Office Automation Executables 49
Office Add-Ins 60
Code Behind a Document 65
Conclusion 72
Part II: Office Programming in .NET 73Chapter 3: Programming Excel 75
Ways to Customize Excel 75
Programming User-Defined Functions 83
Introduction to the Excel Object Model 92
Conclusion 98
Chapter 4: Working with Excel Events 99
Events in the Excel Object Model 99
Events in Visual Studio 2005 Tools for Office 138
Conclusion 142
Chapter 5: Working with Excel Objects 143
Working with the Application Object 143
Working with the Workbooks Collection 157
Working with the Workbook Object 161
Working with the Worksheets, Charts, and Sheets Collections 169
Working with Document Properties 172
Working with the Windows Collections 175
Working with the Window Object 179
Working with the Names Collection and Name Object 181
Working with the Worksheet Object 183
Working with the Range Object 197
Special Excel Issues 213
Conclusion 220
Chapter 6: Programming Word 223
Ways to Customize Word 223
Programming Research Services 229
Introduction to the Word Object Model 237
Conclusion 238
Chapter 7: Working with Word Events 243
Events in the Word Object Model 243
Why Are There Multiple Application and Document Event Interfaces? 244
Events in Visual Studio Tools for Office 273
Conclusion 275
Chapter 8: Working with Word Objects 277
Working with the Application Object 277
Working with the Dialog Object 299
Working with Windows 304
Working with Templates 307
Working with Documents 310
Working with a Document 315
Working with the Range Object 335
Working with Bookmarks 358
Working with Tables 360
Conclusion 362
Chapter 9: Programming Outlook 363
Ways to Customize Outlook 363
Custom Property Pages 370
Introduction to the Outlook Object Model 378
Introduction to the Collaboration Data Objects 382
Conclusion 386
Chapter 10: Working with Outlook Events 387
Events in the Outlook Object Model 387
Application-Level Events 392
Outlook Item Events 405
Other Events 419
Conclusion 422
Chapter 11: Working with Outlook Objects 423
Working with the Application Object 423
Working with the Explorers and Inspectors Collections 431
Working with the Explorer Object 433
Working with the Inspector Object 440
Working with the NameSpace Object 443
Working with the MAPIFolder Object 450
Working with the Items Collection 459
Properties and Methods Common to Outlook Items 466
Outlook Issues 486
Conclusion 492
Chapter 12: Introduction to InfoPath 493
What Is InfoPath? 493
Getting Started 494
Form Security 499
Programming InfoPath 505
Data Source Events 509
Form Events, Properties, and Methods 518
Conclusion 529
Part III: Office Programming in VSTO 531Chapter 13: The VSTO Programming Model 533
The VSTO Programming Model 533
VSTO Extensions to Word and Excel Objects 536
Dynamic Controls 542
Inspecting the Generated Code 549
VSTO Extensions to the Word and Excel Object Models 555
Conclusion 569
Chapter 14: Using Windows Forms in VSTO 571
Introduction 571
Adding Windows Forms Controls to Your Document 577
Writing Code Behind a Control 584
The Windows Forms Control Hosting Architecture 585
Properties Merged from OLEObject or OLEControl 594
Adding Controls at Runtime 597
Conclusion 605
Chapter 15: Working with the Actions Pane 607
Introduction to the Actions Pane 607
Working with the ActionsPane Control 613
Conclusion 628
Chapter 16: Working with Smart Tags in VSTO 629
Introduction to Smart Tags 629
Creating Document-Level Smart Tags with VSTO 633
Creating Application-Level Smart Tags 647
Conclusion 672
Chapter 17: VSTO Data Programming 673
Creating a Data-Bound Customized Spreadsheet with VSTO 673
Creating a Data-Bound Customized Word Document with VSTO 681
Datasets, Adapters, and Sources 682
Another Technique for Creating Data-Bound Spreadsheets 691
Caching Data in the Data Island 699
Advanced ADO.NET Data Binding: Looking Behind the Scenes 704
Binding-Related Extensions to Host Items and Host Controls 705
Conclusion 712
Chapter 18: Server Data Scenarios 713
Populating a Document with Data on the Server 713
Using ServerDocument and ASP.NET 716
A Handy Client-Side ServerDocument Utility 724
The ServerDocument Object Model 726
Conclusion 737
Chapter 19: .NET Code Security 739
Code-Access Security Versus Role-Based Security 740
Code-Access Security in .NET 741
Location, Location, Location 749
Strong Names 753
Publisher Certificates 761
Trusting the Document 765
Deploying Policy to User Machines 769
Conclusion 773
Chapter 20: Deployment 775
VSTO Prerequisites 776
Deploying to an Intranet Shared Directory or Web Site 777
Local Machine Deployment Without a Deployment Manifest 785
Editing Manifests 787
Creating Setup Packages 793
Conclusion 805
Part IV: Advanced Office Programming 807Chapter 21: Working with XML in Excel 809
Introduction to Excel’s XML Features 809
Introduction to XML Schema Creation in Visual Studio 811
An End-to-End Scenario 816
Advanced XML Features in Excel 826
Excel-Friendly XML Schemas 830
VSTO Support for Excel Schema Mapping 833
Conclusion 849
Chapter 22: Working with XML in Word 851
Introduction to Word’s XML Features 851
An End-to-End Scenario: Creating a Schema and Mapping It into a Word Document 855
Exporting the Mapped XML in the Document to an XML Data File 869
Importing an XML Data File into the Mapped Document 871
The XML Options Dialog Box 877
VSTO Support for Word Schema Mapping 880
VSTO Support for the WordML File Format 888
Conclusion 889
Chapter 23: Developing COM Add-Ins for Word and Excel 891
Introduction to Add-Ins 891
Scenarios for Using Add-Ins 892
How a COM Add-In Is Registered 893
Implementing IDTExtensibility2 897
Writing a COM Add-In Using Visual Studio 904
The Pitfalls of mscoree.dll 914
COM Interop and regasm.exe 914
Shimming: A Solution to the Problems with mscoree.dll 919
Conclusion 920
Chapter 24: Creating Outlook Add-Ins with VSTO 921
Moving Away from COM Add-Ins 921
Creating an Outlook Add-In in VSTO 933
Conclusion 940
Bibliography 941Index 943
商品描述(中文翻譯)
**描述**
“隨著應用程式開發社群如此專注於智慧客戶端革命,涵蓋 VSTO 從 A 到 Z 的書籍既重要又必要。這本書不負眾望。它內容詳盡,擁有大量範例程式碼,並以一般術語涵蓋 Office 程式設計——這些主題對於多年專注於 ASP.NET 應用程式的資深 .NET 開發者來說可能是陌生的。恭喜 Eric Lippert 和 Eric Carter 完成如此有價值的作品!”
— Tim Huckaby, InterKnowlogy 首席執行官,微軟區域總監
“這本書以清晰簡潔的方式涵蓋了使用 Visual Studio Tools for Office 程式設計的所有細節。考慮到作者在這個主題上的豐富經驗,沒有比這本書更具權威性的 VSTO 描述了!”
— Paul Vick, 微軟公司 Visual Basic .NET 技術負責人
“Eric 和 Eric 真的了解這個領域。專業程式設計師將會喜愛 Visual Studio 和 .NET 的強大功能,以及利用 Office 可程式化的能力。這本書將引導你編寫 Excel、Word、InfoPath 和 Outlook 解決方案。”
— Vernon W. Hui, 微軟公司測試負責人
“這本書是一本深入、專業且權威的指南,專注於使用 Visual Studio Tools for Office 2005 進行程式設計。對於任何從事 Office 開發的人來說,這是一本必備的書籍。”
— Siew Moi Khor, 微軟公司程式設計師/作家
“我們不會為輕鬆閱讀而購買技術書籍。我們購買它們作為開發解決方案的資源。這本書是對於剛開始進行智慧客戶端開發的人來說的優秀資源。例如,常聽到的評論是‘使用 VSTO 2005 操作 Office 2003 的任務窗格很簡單’,但直到你看到第 15 章開頭的範例,才難以將‘簡單’放在正確的視角中。這是一本詳盡的書,涵蓋了從你的應用程式調用 Office 應用程式到構建智慧文件的所有內容。它使傳統的 Windows 開發者能夠真正利用 Office 2003 的強大功能。”
— Bill Sheldon, InterKnowlogy 首席工程師,MVP
“Eric Carter 和 Eric Lippert 一直是 Office 開發和 Visual Studio Tools for Office 2005 的推動力。他們對 VSTO 和 Office 的深厚知識和理解在這本書中顯而易見。專業開發者在使用 VSTO 2005 和 Office System 2003 架構企業解決方案時,現在擁有了一個新的技術武器。”
— Paul Stubbs, 微軟公司計畫經理
“這本書既是學習工具也是參考書,擁有豐富的表格,包含物件模型物件及其屬性、方法和事件。我會推薦給任何考慮使用 .NET 框架進行 Office 開發的人,特別是對 VSTO 程式設計感興趣的人。”
— Rufus Littlefield, 微軟公司軟體設計工程師/測試員
**Visual Studio Tools for Office** 是 VSTO 2005 程式設計的首本且權威的書籍,由該技術的發明者撰寫。VSTO 是一組工具,允許專業開發者利用 Visual Studio .NET 和 .NET Framework 的全部功能,將程式碼放置於 Excel 2003、Word 2003、Outlook 2003 和 InfoPath 2003 背後。
VSTO 提供了 Office 開發者前所未有的功能:數據綁定和數據/視圖分離、在 Visual Studio 中查看 Excel 和 Word 文件的設計時視圖、在文檔中豐富支持 Windows Forms 控件、創建自定義 Office 任務窗格的能力、針對 Office 的伺服器端程式設計支持等等。
Carter 和 Lippert 以敏銳的洞察力涵蓋了 .NET 開發者學習 VSTO 的需求。這本書:
- 解釋了 Microsoft Office 程式設計的架構並介紹了物件模型
- 教授 Office 解決方案的三種基本模式:Office 自動化可執行檔、Office 外掛和文檔後面的程式碼
- 探索自定義 Excel、Word、Outlook 和 InfoPath 的方法,並深入研究其事件和物件模型的程式設計
- 介紹 VSTO 程式設計模型
- 教授如何在 VSTO 中使用 Windows Forms 以及如何使用 Actions Pane
- 深入探討 VSTO 數據程式設計和伺服器數據場景
- 探索 .NET 代碼安全性和 VSTO 部署
進階材料涵蓋在 Word 和 Excel 中使用 XML、為 Word 和 Excel 開發 COM 外掛,以及使用 VSTO 創建 Outlook 外掛。
完整的程式碼範例可在本書的網頁上獲得。
**目錄**
- 圖表 xxxi
- 表格 xlv
- 前言 xlix
- 序言 liii
- 感謝 lvii
- 關於作者 lix
- 第一部分:VSTO 簡介 1
- 第一章:Office 程式設計簡介 3
- 為什麼選擇 Office 程式設計? 3
- Office 物件模型 6
- 屬性、方法和事件 12
- Office 主要互操作組件 (PIAs) 34
- 結論 43
- 第二章:Office 解決方案簡介 45
- Office 解決方案的三種基本模式 45
- Office 自動化可執行檔 49
- Office 外掛 60
- 文檔後面的程式碼 65
- 結論 72
- 第二部分:.NET 中的 Office 程式設計 73
- 第三章:編程 Excel 75
- 自定義 Excel 的方法 75
- 編程用戶定義函數 83
- Excel 物件模型簡介 92
- 結論 98
- 第四章:處理 Excel 事件 99
- Excel 物件模型中的事件 99
- Visual Studio 2005 Tools for Office 中的事件 138
- 結論 142
- 第五章:處理 Excel 物件 143
- 處理應用程式物件 143
- 處理工作簿集合 157
- 處理工作簿物件 161
- 處理工作表、圖表和工作表集合 169
- 處理文檔屬性 172
- 處理窗口集合 175
- 處理窗口物件 179
- 處理名稱集合和名稱物件 181
- 處理工作表物件 183
- 處理範圍物件 197
- 特殊 Excel 問題 213
- 結論 220
- 第六章:編程 Word 223
- 自定義 Word 的方法 223
- 編程研究服務 229
- Word 物件模型簡介 237
- 結論 238
- 第七章:處理 Word 事件 243
- Word 物件模型中的事件 243
- 為什麼會有多個應用程式和文檔事件介面? 244
- Visual Studio Tools for Office 中的事件 273
- 結論 275
- 第八章:處理 Word 物件 277
- 處理應用程式物件 277
- 處理對話框物件 299
- 處理窗口 304
- 處理範本 307
- 處理文檔 310
- 處理一個文檔 315
- 處理範圍物件 335
- 處理書籤 358
- 處理表格 360
- 結論 362
- 第九章:編程 Outlook 363
- 自定義 Outlook 的方法 363
- 自定義屬性頁 370
- Outlook 物件模型簡介 378
- 協作數據物件簡介 382
- 結論 386
- 第十章:處理 Outlook 事件 387
- Outlook 物件模型中的事件 387
- 應用程式級事件 392
- Outlook 項目事件 405
- 其他事件 419
- 結論 422
- 第十一章:處理 Outlook 物件 423
- 處理應用程式物件 423
- 處理瀏覽器和檢查器集合 431
- 處理瀏覽器物件 433
- 處理檢查器物件 440
- 處理命名空間物件 443
- 處理 MAPIFolder 物件 450
- 處理項目集合 459
- Outlook 項目的共同屬性和方法 466
- Outlook 問題 486
- 結論 492
- 第十二章:InfoPath 簡介 493
- InfoPath 是什麼? 493
- 開始使用 494
- 表單安全性 499
- 編程 InfoPath 505
- 數據源事件 509
- 表單事件、屬性和方法 518
- 結論 529
- 第三部分:VSTO 中的 Office 程式設計 531
- 第十三章:VSTO 程式設計模型 533
- VSTO 程式設計模型 533
- VSTO 對 Word 和 Excel 物件的擴展 536
- 動態控件 542
- 檢查生成的程式碼 549
- VSTO 對 Word 和 Excel 物件模型的擴展 555
- 結論 569
- 第十四章:在 VSTO 中使用 Windows Forms 571
- 簡介 571
- 將 Windows Forms 控件添加到文檔 577
- 在控件後編寫程式碼 584
- Windows Forms 控件托管架構 585
- 從 OLEObject 或 OLEControl 合併的屬性 594
- 在運行時添加控件 597
- 結論 605
- 第十五章:處理 Actions Pane 607
- Actions Pane 簡介 607
- 處理 ActionsPane 控件 613
- 結論 628
- 第十六章:在 VSTO 中處理智慧標籤 629
- 智慧標籤簡介 629
- 使用 VSTO 創建文檔級智慧標籤 633
- 創建應用程式級智慧標籤 647
- 結論 672
- 第十七章:VSTO 數據程式設計 673
- 使用 VSTO 創建數據綁定的自定義電子表格 673
- 使用 VSTO 創建數據綁定的自定義 Word 文檔 681
- 數據集、適配器和來源 682
- 創建數據綁定電子表格的另一種技術 691
- 在數據島中緩存數據 699
- 進階 ADO.NET 數據綁定:幕後探秘 704
- 與主機項目和主機控件相關的綁定擴展 705
- 結論 712
- 第十八章:伺服器數據場景 713
- 用伺服器上的數據填充文檔 713
- 使用 ServerDocument 和 ASP.NET 716
- 一個方便的客戶端伺服器文檔工具 724
- ServerDocument 物件模型 726
- 結論 737
- 第十九章:.NET 代碼安全性 739
- 代碼訪問安全性與