zoukankan      html  css  js  c++  java
  • Understanding PIA

    The key technology that makes creating an integrated Microsoft Office solution possible is Automation, which is part of the Component Object Model (COM) technology. Automation enables you to use code to create and control software objects exposed by any application, DLL, or ActiveX control that supports the appropriate programmatic interfaces.

    Understanding Primary Interop Assemblies

    Microsoft Office applications expose much of their functionality to Automation. However, you cannot use managed code (such as Visual Basic or C#) directly to automate Office applications. To automate Office applications by using managed code, you must use the Office primary interop assemblies (PIAs). The primary interop assemblies enable managed code to interact with the COM-based object model of the Office applications.

    Every Microsoft Office application has a PIA. When you create an Office project in Visual Studio, a reference to the appropriate PIA is automatically added to the project. To automate the features of other Office applications from the project, you must add a reference to the appropriate PIA manually. For more information, see How to: Target Office Applications Through Primary Interop Assemblies.

    Using Primary Interop Assemblies at Design Time and Run Time

    You must have the Office PIAs installed and registered in the global assembly cache on your development computer to perform most development tasks. For more information, see Configuring a Computer to Develop Office Solutions.

    The PIAs must also be installed on end-user computers to run Office solutions that target the .NET Framework 3.5. However, the Office PIAs are not required on end-user computers to run Office solutions that target the .NET Framework 4. For more information, see Designing and Creating Office Solutions.

    Using Types in Primary Interop Assemblies

    The Office PIAs contain a combination of types that expose the object model of the Office applications and additional infrastructure types that are not intended to be used directly in your code. For an overview of the types in the Office PIAs, see Overview of Classes and Interfaces in the Office Primary Interop Assemblies.

    Because the types in the Office PIAs correspond to types in the COM-based object models, the way you use these types is often different from other managed types. For example, the way you call methods that have optional parameters in an Office primary interop assembly depends on the programming language you are using in your project. For more information, see the following topics:

  • 相关阅读:
    IntelliJ Idea使用代码折叠
    c# 文件属性读取操作及文件之间操作
    c#文件操作
    c++头文件 #include<iostream>
    基本SQL语句
    dd
    c#属性中的get和set属性
    c#
    c#运算表达式
    c#方法
  • 原文地址:https://www.cnblogs.com/malaikuangren/p/2637565.html
Copyright © 2011-2022 走看看