Compartir a través de


Packages Overview

This topic describes the basics of using Packaging APIs to interact with packages.

This topic contains the following sections.

Introduction

A package is an aggregate of data components, like the filing cabinet is an aggregate of an individual or business's paperwork.

Unlike real–world filing systems, packages must conform to a predictable, conceptual organizational system (called the logical model), and predicatable physical characteristics (called the physical model). These standardized conformance requirements are described in the ECMA-376 OpenXML, 1st Edition, Part 2: Open Packaging Conventions (OPC).

To interact with a specific package, the caller uses the Packaging APIs to create a package object that represents the package (a conceptual filing cabinet). All interactions which a package are performed using this package object.

Prerequisites

For a table of prerequisites, see Packaging.

Package Objects

Windows 7 provides the package object implementation of the IOpcPackage interface.

A package object is instantiated to represent a package when the IOpcFactory::CreatePackage or IOpcFactory::ReadPackageFromStream method is called.

A pointer to the IOpcPackage interface of a package object provides access to the IOpcRelationshipSet and IOpcPartSet interface pointers of a relationship set object and a part set object, respectively.

The following diagram shows a package object and the relationship set and part set objects that can be retrieved from it.

illustration showing a package object and the relationship set and part set objects that can be retrieved from it

A relationship set object that is retrieved by calling IOpcPackage::GetRelationshipSet represents the Relationships part that stores package relationships. This object is an unordered set of IOpcRelationship interface pointers to relationship objects. Each relationship object represents one package relationship. For more information about relationship objects and relationship set objects, see the Relationships Overview topic.

The target of a package relationship is often an important part, and it is described by the package format designer or in the OPC. For example, a package relationship can provide access to the Core Properties part that stores package metadata, or to a part containing format-specific data, where the part and data are described by the package designer. The Main Document part of the word processing OpenXML format is one such format-specific part, described in Part 1: Fundamentals in ECMA-376 OpenXML (https://go.microsoft.com/fwlink/p/?linkid=123375).

A part set object, which can only be retrieved by calling the IOpcPackage::GetPartSet method, represents all parts contained in the package that are not Relationships parts. The set is an unordered set of IOpcPart interface pointers to part objects. Each part object represents one part (which is not a Relationships part) in the package. For more information about part objects, see the Parts Overview.

For information about how to create a package object, see the Loading a Package to be Read how-to topic and the IOpcFactory::CreatePackage method.

Packages Fundamentals

Overviews

Open Packaging Conventions Fundamentals

Packages How-To Topics

Getting Started with the Packaging API

Reference

Packaging API Reference

Packaging API Samples

External

ECMA-376 OpenXML