共用方式為


Package Consumption Error Group

When you attempt to access a package that is loaded from an IStream interface, the following error codes may be returned.

Return code/value Description
OPC_E_CONFLICTING_SETTINGS
0x80510014
The selected package creation settings are inconsistent; an example would be creating a package that uses both Force 32-bit mode and Force 64-bit mode.
OPC_E_COULD_NOT_RECOVER
0x8051004E
Errors that occurred during previous operations prevent the requested operation from completing. Future attempts to perform the operation that triggered this error, or attempts to perform related operations, will fail.
OPC_E_DUPLICATE_DEFAULT_EXTENSION
0x8051000F
More than one Default element specifies the same extension in the content type XML markup.
For more information about Default elements and content type XML markup, see the OPC.
OPC_E_DUPLICATE_OVERRIDE_PART
0x8051000D
More than one Override element in the Content Types stream specifies the same part name as the value of its PartName attribute.
If this error is encountered while a package is being read, the package is not valid, because the PartName attribute value for each Override element must be unique.
For more information about Override elements, see the OPC.
OPC_E_DUPLICATE_PART
0x8051000B
A part with the specified part name already exists in the current package.
OPC_E_DUPLICATE_PIECE
0x80510015
A piece with the same piece number already exists in the current package.
Pieces are a result of interleaved parts. If the Packaging API is used to consume a package that supports interleaving, this error may result.
The Packaging API does not support the production of packages that have interleaved parts. For more information about interleaving, see the OPC.
OPC_E_DUPLICATE_RELATIONSHIP
0x80510013
A relationship with the same identifier already exists in the current package.
OPC_E_ENUM_CANNOT_MOVE_NEXT
0x80510051
The current position is already past the last item of the enumerator.
OPC_E_ENUM_CANNOT_MOVE_PREVIOUS
0x80510052
The current position already precedes the first item of the enumerator.
OPC_E_ENUM_COLLECTION_CHANGED
0x80510050
The enumerator is invalid because the underlying set has changed.
OPC_E_ENUM_INVALID_POSITION
0x80510053
The enumerator cannot perform this operation from its current position.
OPC_E_ENUM_CANNOT_MOVE_PREVIOUS
0x80510052
The current position already precedes the first item of the enumerator.
OPC_E_ENUM_COLLECTION_CHANGED
0x80510050
The enumerator is invalid because the underlying set has changed.
OPC_E_ENUM_INVALID_POSITION
0x80510053
The enumerator cannot perform this operation from its current position.
OPC_E_INVALID_CONTENT_TYPE
0x80510044
A content type does not conform to the rules for a valid media type, specified in RFC 2616: HTTP/1.1 (https://go.microsoft.com/fwlink/p/?linkid=143979) and the OPC.
OPC_E_INVALID_CONTENT_TYPE_XML
0x80510006
The XML markup that defines package content types in the Content Types stream is not well-formed.
OPC_E_INVALID_DEFAULT_EXTENSION
0x8051000E
An extension that is provided for a default content type is not valid, because it does not conform to the rules for a part name, specified in the OPC.
OPC_E_INVALID_OVERRIDE_PART_NAME
0x8051000C
The part name that is used as the value of the PartName attribute of an Override element in the Content Types stream does not conform to the rules for a valid part name, specified in RFC 3986: URI Generic Syntax (https://go.microsoft.com/fwlink/p/?linkid=143950) and the OPC.
For more information about Override elements, see the OPC.
OPC_E_INVALID_PIECE
0x80510016
An unexpected piece was found.
Pieces are a result of interleaved parts. If the Packaging API is used to consume a package that has interleaved parts, this error may result.
The Packaging API does not support the production of packages that have interleaved parts. For more information about interleaving, see the OPC.
OPC_E_INVALID_RELATIONSHIP_ID
0x80510010
The Id attribute of a relationship does not conform to the rules specified in the OPC.
OPC_E_INVALID_RELATIONSHIP_TARGET
0x80510012
The Target attribute of a relationship does not conform to the rules specified in the OPC.
OPC_E_INVALID_RELATIONSHIP_TARGET_MODE
0x8051004D
The TargetMode attribute of a relationship does not conform to the rules specified in the OPC.
OPC_E_INVALID_RELATIONSHIP_TYPE
0x80510011
The Type attribute of a relationship does not conform to the rules specified in the OPC.
OPC_E_INVALID_RELS_XML
0x8051000A
The relationship markup for a Relationships part is not well-formed XML.
OPC_E_INVALID_XML_ENCODING
0x80510042
The XML Encoding attribute must be UTF-8 or UTF-16.
OPC_E_MC_INCONSISTENT_PRESERVE_ATTRIBUTES
0x8051004B
The PreserveAttributes attribute does not have a matching Ignorable attribute on the same element.
OPC_E_MC_INCONSISTENT_PRESERVE_ELEMENTS
0x8051004C
The PreserveElements attribute does not have a matching Ignorable attribute on the same element.
OPC_E_MC_INCONSISTENT_PROCESS_CONTENT
0x8051004A
The ProcessContent attribute does not have a matching Ignorable attribute on the same element.
OPC_E_MC_INVALID_ATTRIBUTES_ON_IGNORABLE_ELEMENT
0x80510040
An element (or its parent) that is ignorable by markup compatibility has an attribute that is prohibited in Part 5: Markup Compatibility and Extensibility of ECMA-376 OpenXML (https://go.microsoft.com/fwlink/p/?linkid=123375).
OPC_E_MC_INVALID_ENUM_TYPE
0x8051003C
Encountered an enumeration type that is not valid.
OPC_E_MC_INVALID_PREFIX_LIST
0x80510037
The prefix list cannot be parsed, because it contains a character that is not valid, such as ':'.
OPC_E_MC_INVALID_QNAME_LIST
0x80510038
A markup compatibility attribute contains an invalid list of element names.
OPC_E_MC_INVALID_XMLNS_ATTRIBUTE
0x80510041
The declaration of an xmlns attribute is malformed.
OPC_E_MC_MISSING_CHOICE
0x8051003B
An AlternateContent element must have at least one Choice element as a child.
OPC_E_MC_MISSING_REQUIRES_ATTR
0x80510035
A markup compatibility element that requires the Requires attribute is missing the attribute, or that attribute's value is empty.
OPC_E_MC_MULTIPLE_FALLBACK_ELEMENTS
0x80510049
There is more than one Fallback element within the child elements of an AlternateContent, but only one is allowed.
OPC_E_MC_NESTED_ALTERNATE_CONTENT
0x80510039
An AlternateContent element cannot have another AlternateContent element as a child.
OPC_E_MC_UNEXPECTED_ATTR
0x80510036
A markup compatibility element has an attribute that is not recognized or supported in the markup compatibility namespace.
OPC_E_MC_UNEXPECTED_CHOICE
0x8051003A
A Choice element was encountered after the Fallback element, or more than one Fallback element was encountered.
OPC_E_MC_UNEXPECTED_ELEMENT
0x80510033
An element that is used in the markup compatibility namespace is not recognized as a valid markup compatibility element.
OPC_E_MC_UNEXPECTED_REQUIRES_ATTR
0x80510034
The Requires attribute was found on a markup compatibility element that does not support this attribute.
OPC_E_MC_UNKNOWN_NAMESPACE
0x8051003E
The MustUnderstand attribute of an element contains a namespace that is not recognized.
OPC_E_MC_UNKNOWN_PREFIX
0x8051003F
The package contains an XML prefix that is not defined.
OPC_E_MISSING_CONTENT_TYPES
0x80510007
Could not find the part that contains Content Types stream.
OPC_E_MISSING_PIECE
0x80510017
One or more pieces of an interleaved part were not found.
A piece is a file that contains data for an interleaved part. This error may result if the Packaging APIs are used to consume a package that has interleaved parts. Production of packages that have interleaved parts is not supported by the Packaging APIs. For more information about interleaving, see the OPC.
OPC_E_NO_SUCH_PART
0x80510018
The specified part does not exist.
OPC_E_NONCONFORMING_CONTENT_TYPES_XML
0x80510008
The Content Types stream XML markup does not conform to the syntax specified in RFC 2616: HTTP/1.1 and the OPC.
OPC_E_NONCONFORMING_RELS_XML
0x80510009
The relationship markup does not conform to the rules specified in the OPC.
OPC_E_PART_CANNOT_BE_DIRECTORY
0x80510004
The part name of one part is a segment in the path of the part name of another part. An example would be a part named "path/dirorfile/file.txt" and a part named "path/dirorfile".
OPC_E_UNEXPECTED_CONTENT_TYPE
0x80510005
Either the content type of a part differed from the expected content type (specified in the OPC, ECMA-376 Part 2), or the part content did not match the part's content type.
OPC_E_UNSUPPORTED_PACKAGE
0x8051004F
The OPC allows certain aspects of a package, such as the number of pieces used to compose a part, to grow without bounds.
For practical purposes, however, the Packaging API limits the possible number of pieces to an unsigned DWORD.
OPC_E_ZIP_CENTRAL_DIRECTORY_TOO_LARGE
0x80511009
The central directory exceeds 65,535 bytes.
OPC_E_ZIP_COMMENT_TOO_LARGE
0x8051100C
The file comment length exceeds 65,535 bytes.
OPC_E_ZIP_COMPRESSION_FAILED
0x80511003
Compression of the data failed.
OPC_E_ZIP_CORRUPTED_ARCHIVE
0x80511002
The archive has an incorrect checksum or signature, or file headers in the central directory are in an unexpected order.
OPC_E_ZIP_DECOMPRESSION_FAILED
0x80511004
Data decompression failed.
OPC_E_ZIP_DUPLICATE_NAME
0x8051100B
Two file items in the archive have the same name.
OPC_E_ZIP_EXTRA_FIELDS_TOO_LARGE
0x8051100D
The extra field length exceeds 65,535 bytes.
OPC_E_ZIP_FILE_HEADER_TOO_LARGE
0x8051100E
The length of a local file header exceeds 65,535 bytes.
OPC_E_ZIP_INCONSISTENT_DIRECTORY
0x80511006
The number of file items found in the archive does not match the number of file items recorded in the central directory.
OPC_E_ZIP_INCONSISTENT_FILEITEM
0x80511005
The file attributes recorded in a file header in the central directory are inconsistent with the attributes of the zipped file item.
OPC_E_ZIP_INCORRECT_DATA_SIZE
0x80511001
A field or header in the archive contains a different number of bytes than expected.
OPC_E_ZIP_MISSING_DATA_DESCRIPTOR
0x80511007
A data descriptor was expected for the file item, but none was found.
OPC_E_ZIP_MISSING_END_OF_CENTRAL_DIRECTORY
0x8051100F
The archive is missing the end of the central directory record.
OPC_E_ZIP_NAME_TOO_LARGE
0x8051100A
The length of a file item name exceeds 65,535 characters.
OPC_E_ZIP_REQUIRES_64_BIT
0x80511010
The 64-bit ZIP format is required because the data exceeds the capacity of the 32-bit ZIP format. Recreate the package using the 64-bit ZIP format.
OPC_E_ZIP_UNSUPPORTEDARCHIVE
0x80511008
The package cannot be read because the archive is either unsupported (for example, a multidisk) or encrypted.

Remarks

For more information about error handling in COM, see the Error Handling (COM) topic.

Requirements

Header
Msopc.h

See also

Packaging Errors

Overviews

Getting Started with the Packaging API

Packaging API Programming Guide

Reference

Packaging API Reference

Packaging API Samples

Part URI Error Group

External Resources

ECMA-376 OpenXML standard

RFC 2616: HTTP/1.1

RFC 3986: URI Generic Syntax

W3C Recommendation, XML-Signature Syntax and Processing

ZIP File Format Specification from PKWARE, Inc., version 6.2.0 (2004)