You are previewing Microsoft® .NET Development for Microsoft Office.
O'Reilly logo
Microsoft® .NET Development for Microsoft Office

Book Description

This book delivers real-world strategies and coding techniques for creating Microsoft Office–based solutions that work seamlessly in the .NET environment—information that’s been put to work by Microsoft’s own product support and development teams.

Table of Contents

  1. Microsoft® .NET Development for Microsoft Office
  2. A Note Regarding Supplemental Files
  3. Introduction
    1. How This Book Is Organized
    2. Who This Book Is For
    3. System Requirements and Code Samples
    4. Microsoft Learning Technical Support
    5. Acknowledgments
  4. 1. Overview
    1. 1.1. Version Variations
    2. 1.2. Notes on the Samples
  5. 2. Basics of Office Interoperability
    1. 2.1. Managed Interop Assemblies
      1. Office XP PIAs
      2. Office 2003 PIAs
    2. 2.2. Basic Interop Projects
      1. Basic Interop with Excel
      2. Interop with Office 97 and Office 2000
      3. Basic Interop with Word
      4. Basic Interop with Outlook
      5. Basic Interop with PowerPoint
    3. 2.3. Visual Studio .NET Office Interop Wizards
    4. 2.4. Interface/Class Ambiguity
      1. C# Version
      2. Visual Basic .NET Version
    5. 2.5. Releasing COM Objects
      1. Simple Garbage Collection
      2. Using ReleaseComObject
      3. AppDomain Unloading
    6. 2.6. Visual Basic .NET vs. C#
      1. Optional Parameters and Word Reference Parameters
      2. Excel Parameterized Properties and Word Accessors
      3. Accessing Late-Bound Members
    7. 2.7. Debugging Interop Solutions
      1. Use Structured Exception Handling
      2. Check Assembly Dependencies
    8. Summary
  6. 3. Office Interop Techniques
    1. 3.1. Platform Invoke
      1. Functions with Simple Parameters
      2. Functions with Struct Parameters
    2. 3.2. Watching Excel Quit
    3. 3.3. Using COM by Reflection
      1. Using GetTypeFromProgID
      2. Traversing a COM Object Model
    4. 3.4. Document Properties
    5. 3.5. Connecting to Running Instances
      1. Starting Excel with Process.Start
      2. Using GetActiveObject
      3. Using BindToMoniker
    6. 3.6. Office Accessible Objects
    7. 3.7. Monitoring Office Applications
      1. Phase 1: Core Functionality
      2. Phase 2: Bringing Excel to the Front
        1. Phase 2: Excel 2000 Specifics
    8. Summary
  7. 4. Integrating Managed Code
    1. 4.1. Calling Managed Code from VBA
      1. Managed Code
      2. Client VBA
    2. 4.2. Managed CCW in VBA
      1. Managed Component
      2. Managed Test Client
      3. VBA Client
    3. 4.3. Managed Office Accelerators
      1. Managed Code
      2. Client VBA
    4. 4.4. Programming the Visual Basic Editor
    5. 4.5. Office and Managed Windows
      1. Managed Windows Form
      2. Interop Interface
      3. Excel VBA Client
    6. 4.6. Office Document Browser
      1. Additional Step for Office 97
    7. 4.7. COM Drag-And-Drop
      1. Dropping Word Text
      2. Dropping Excel Text
      3. Dropping Excel Cells
      4. Dropping into Office
    8. Summary
  8. 5. Add-Ins
    1. 5.1. Managed COM Add-Ins
      1. Basic Add-In
      2. Add-In Connection/Disconnection
      3. Custom Button
      4. Working with the Setup Project
    2. 5.2. Simple Add-In Projects
      1. Excel Add-In
      2. Word Add-In
      3. Outlook Add-In
      4. PowerPoint Add-In
    3. 5.3. Multiple Host Applications
    4. 5.4. Add-Ins and User Controls
      1. Core Add-In
      2. Calendar and Clock Controls
    5. 5.5. Tactical Add-In Issues
      1. Command UI Object Scoping
      2. Button Images
      3. Add-In Disabling
    6. 5.6. COM Add-Ins as Cell Functions
      1. Managed COM Add-In
      2. Excel Client
    7. 5.7. Excel Automation Add-Ins
    8. Summary
  9. 6. Smart Tags
    1. 6.1. Managed Smart Tags
      1. The Initial Project
      2. Custom Action Behavior
      3. Implementing ISmartTagRecognizer
      4. Implementing ISmartTagAction
      5. Building and Deploying
    2. 6.2. Smart Tags and the VSTO Loader
      1. The Initial Project
      2. Implementing ISmartTagRecognizer and ISmartTagAction
      3. Building and Deploying
    3. 6.3. ISmartTagRecognizer2 and ISmartTagAction2
      1. Dynamic Captions
      2. Cascading Menus
      3. The Tokenizer
    4. 6.4. MOSTL Smart Tags
    5. 6.5. A MOSTL Generator
    6. 6.6. Troubleshooting Smart Tags
    7. Summary
  10. 7. Office Documents and Data
    1. 7.1. Excel and SQL Data
    2. 7.2. Excel and XML
      1. Generating an XML File
      2. Applying an XSL File
      3. Automating Excel
      4. Using the Web Browser Control
    3. 7.3. Excel and OLE DB
      1. Reading Excel Cell Data
      2. WHERE Clause
      3. Headers and Multiple Rows
      4. UPDATE
      5. Inserting a New Row
      6. Mixed Types
    4. 7.4. Managed Data Feed
      1. A Managed "Live Data Feed" Component
      2. Excel VBA Client
    5. 7.5. Real-Time Data in Excel
      1. A Managed RTD Component
      2. A Stock Data Class
      3. IRtdServer Methods
      4. The Excel Client
    6. 7.6. Sinking Office Events
      1. The Core Solution
      2. Private Sink Helpers (Pre–Office 2003)
      3. Tracking Cell References
    7. Summary
  11. 8. Isolating Managed Extensions
    1. AppDomain Isolation
    2. 8.1. The COM Shim Wizard
      1. How the Wizard Works
    3. 8.2. Creating an Add-In Shim
    4. 8.3. Creating a Smart Tag Shim
    5. 8.4. Shim Wizard Internals
      1. Additional Shim Wizard Features
      2. Known Issues
    6. 8.5. Config Files
      1. Custom XML Parsing
      2. Shimmed AppDomain Configs
      3. Multiple Configured Add-Ins
    7. Summary
  12. 9. Web Services and Remoting
    1. 9.1. The SOAP Toolkit
      1. A Sample Web Service
      2. A Web Service Proxy
      3. SOAP Toolkit Code
      4. UDDI
    2. 9.2. Managed Web Service Proxies
    3. 9.3. WSE Security
      1. The Core Add-In
      2. The Web Service Proxy
      3. The WSE Client Proxy
      4. The WSE Web Service
    4. 9.4. Research Services
      1. Raw SDK Research Service
      2. Research Services Class Library
    5. 9.5. Remoting with Office
      1. ChatCoordinator SAO
      2. Chat Server Host
      3. Chat Delegate
      4. A WinChat Client
      5. OfficeChat Add-In Client
    6. Summary
  13. 10. Visual Studio Tools for Office
    1. 10.1. VSTO Code-Behind Assemblies
    2. 10.2. Custom Document Properties
    3. 10.3. Debugging VSTO Solutions
      1. Clearing the Cached Shadow Copy
      2. Avoiding Swallowed Exceptions
    4. 10.4. Word Code-Behind
      1. Word Document Project
      2. Word Template Project
    5. 10.5. XML Lists
      1. Importing a List from XML
      2. Creating a List Programmatically
    6. 10.6. XML Data Form
      1. A Custom Command Bar
      2. Populating the List from SQL Data
      3. Creating an XSD
      4. Building a Form
      5. Dynamic Queries
    7. 10.7. VSTO and Web Services
    8. 10.8. VSTO Configs
    9. Summary
  14. 11. Smart Documents
    1. 11.1. Smart Documents Core
      1. The Initial Project
      2. Defining All Elements
      3. Defining Each Element’s Task Pane Controls
      4. Populating Each Control
      5. Specifying Control Behavior
      6. Deployment
      7. Testing
    2. 11.2. Multiple Target Applications
    3. 11.3. Smart Documents and PIAs
    4. 11.4. Vertigo Managed Smart Documents Wrapper
      1. The Initial Project
      2. Controls and Behavior
      3. A Variation for Word
    5. 11.5. Smart Documents and Smart Tags
      1. Smart Tags
      2. Smart Document
    6. 11.6. MOSTL Smart Documents
    7. Summary
  15. 12. Security
    1. 12.1. Office Macro Security
    2. 12.2. Code Access Security
      1. Evidence
      2. Security Policy
      3. Permissions
    3. 12.3. VSTO Security
      1. Using MSCorCfg
      2. Using CASPol
      3. Encrypted Office Documents
      4. Information Rights Management
    4. 12.4. Strong-Naming
      1. Delay-Signing
      2. Initial Assembly and Delay-Signing
      3. Strong-Name Security Evidence
      4. GAC-Deploying Code-Behind Assemblies
      5. Strong-Naming an ActiveX Control
    5. 12.5. Authenticode Certificates
      1. Strong-Naming
      2. Authenticode Signatures
      3. The Publisher Code Group
    6. 12.6. VSTO Deployment Options
      1. Local Deployment Changes
      2. Assembly Deployed to a Network Share
      3. Workbook Deployed to a Network Share
      4. Assembly Deployed to a Web Site
      5. Updating VSTO Solutions
      6. OfficeDocumentMembershipCondition
    7. 12.7. Smart Document Security
    8. Summary
  16. Andrew Whitechapel
  17. Index
  18. About the Author
  19. Copyright