IOpcPart interface

Represents a part that contains data and is not a Relationships part.


The IOpcPart interface inherits from the IUnknown interface. IOpcPart also has these types of members:


The IOpcPart interface has these methods.

Method Description
IOpcPart::GetCompressionOptions Gets a value that describes the way part content is compressed.
IOpcPart::GetContentStream Gets a stream that provides read/write access to part content.
IOpcPart::GetContentType Gets the media type of part content.
IOpcPart::GetName Gets a part URI object that represents the part name.
IOpcPart::GetRelationshipSet Gets a relationship set object that represents the Relationships part that stores relationships that have the part as their source.


To create a part object to represent a part, call the IOpcPartSet::CreatePart method. To get a pointer to the interface of a part object that represents an existing part, call the IOpcPartSet::GetPart or IOpcPartEnumerator::GetCurrent method.

A Relationships part cannot be represented by an implementation of the IOpcPart interface.

Methods of an IOpcPart interface provide access to part information through the properties listed in the following table:

Method Property Description
GetCompressionOptions Compression The compression option to be used on part content.
GetContentStream Content The stream of bytes that makes up the part as described in the ECMA-376 OpenXML, 1st Edition, Part 2: Open Packaging Conventions (OPC).
GetContentType Content type The media type of the part content, as specified by the package designer in compliance with the rules in the OPC.
GetName Name The URI of the part in the package.

For more information about parts, see the Open Packaging Conventions Fundamentals and the OPC.

Thread Safety

Packaging objects are not thread-safe.

For more information, see the Getting Started with the Packaging API.


Minimum supported client Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header msopc.h

See also

Core Packaging Interfaces

ECMA-376 OpenXML

External Resources

Getting Started with the Packaging API




Open Packaging Conventions Fundamentals


Packaging API Reference

Packaging API Samples

Parts Overview