|Open Packaging Convention|
|Developed by||Microsoft +, Ecma International +, ISO/IEC +|
|Initial release||December 7, 2006|
|Latest release||ISO/IEC 29500:2008|
|Standard||ECMA-376, ISO/IEC 29500|
|File formats category -|
The Open Packaging Conventions (OPC) is a file packaging format created by Microsoft for storing a combination of XML and non-XML files that together form a single entity in a single compressed file container. This format combines the advantages of leaving the independent file entities embedded in the document intact and resulting in much smaller files compared to normal use of XML.
A file following the OPC is a standard ZIP archive consisting of files, or parts. The file itself (which contains the parts) is called a package. Individual parts may be related to other parts in the package or external files through relationships.
Parts specify individual information or objects in the package. For example, in a presentation, each slide is represented by its own part.
Relationships are of two types:
- Package-level relationships, which specify relationships between the package itself and a part in it (internal) or an external resource. These may be used for example to refer to the main part in the package.
- Part-level relationships, which specify relationships between a part and another part (internal) or an external resource.
_rels folder contains the package-level relationships for the file. The
_rels\.rels file in that folder is an XML file contains the relationships. (Parts are typically XML files, and tags usually have names in "proper case", as in "Proper Case".) A .rels file typically takes the following form (this is from an MS Word document):
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"> <Relationship Id="rId1" Type="http://..." Target="word/document.xml" /> ... </Relationships>
Part-level relationships may be found in any other .rels file or _rels folder.
[Content_Types].xml file in the root defines the different file formats used in the package. Example:
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"> <!-- defines that files ending in .jpeg are of Internet media type "image/jpeg". See the Internet media type article for more info. --> <Default Extension="jpeg" ContentType="image/jpeg"/> <!-- defines the type of .rels files. (see above) --> <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/> <!-- defines the type of .xml files. --> <Default Extension="xml" ContentType="application/xml"/> <!-- overrides the processing of the type for a specific part. --> <Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/> ... </Types>
Note that types for specific parts may be overridden using the Override tag, which overrides any Default tag for the file type.
Files using the OPC can be opened using ordinary ZIP utilities. Open source libraries for .NET and Java are available for using Open Packaging Conventions. The .NET Framework, versions 3.0 and 3.5, contains the WindowsBase component, which can process ZIP packages and abstract classes for packages, using classes in the System.IO.Package namespace. An SDK is also available.
- ↑ http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=51459
- ↑ Ecma International TC45 (2006-12). "Standard ECMA-376 Office Open XML File Formats". Ecma International.