3.10 Activating embedded packages in Office (Part 1 Section L.7.2 Embeddings)

When an embedded package (Part 1 Section L.7.2 Embeddings) is encountered and the user requests activation of the object, the following procedure is followed:

1. The content-type for the embedded package is determined by interrogating \[Content_Types].xml in the containing package.

2. The registered file extension for the content-type is determined by enumerating the Windows registry keys under "HKEY_CLASSES_ROOT\MIME\Database\Content Type" for a key value that matches the content-type.

1. If a matching key is found, then the value data for the REG_SZ value "Extension" is the extension for the embedded package.

2. If a matching key is not found, then the embedded package cannot be activated.

3. The PROG_ID for the content-type's extensions is determined by querying the Default REG_SZ value for the Windows registry key defined by concatenating HKEY_CLASSES_ROOT with the content-type's extension value [Example: if the content-type's extension is ".xlsx", then the Windows registry key to query is "HKEY_CLASSES_ROOT\.xlsx". The Default REG_SZ value for this key is "Excel.Sheet.12". This is the PROG_ID for this content-type.]

4. The CLSID for the content-type is determined by querying the Default REG_SZ value for the Windows registry key defined by concatenating HKEY_CLASSES_ROOT with the content-type's PROG_ID and "CLSID". [Example: if the content-type's PROG_ID is "Excel.Sheet.12", then the Windows registry key to query is "HKEY_CLASSES_ROOT\Excel.Sheet.12\CLSID". The Default REG_SZ value for this key is "{00020830-0000-0000-C000-000000000046}".]

1. If the CLSID value is any of the following values, activation will fail:

1. "{000CEEDB-0000-0000-C000-000000000046}"

2. "{000CEEDA-0000-0000-C000-000000000046}"

3. "{637b1c13-8617-4985-8fe7-e66935ba677d}"

5. The MainPartContentType for the content-type is determined by querying the MainPartContentType registry value under the registry key defined by concatenating HKEY_CLASSES_ROOT\CLSID with the CLSID value for the content-type with "MainPartContentType". [Example: if the CLSID value for the content-type is "{00020830-0000-0000-C000-000000000046}", then the Windows registry value to query is "HKEY_CLASSES_ROOT\CLSID\{00020830-0000-0000-C000-000000000046}\MainPartContentType".]

1. If this value does not exist, this step is skipped and activation will continue.

2. If this value does exist, then the embedded package MUST meet the following conditions. If any of these conditions are not true, then activation of the embedded package will fail.

1. A single relationship of type "http://purl.oclc.org/ooxml/officeDocument/relationships/officeDocument" ("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" for packages conforming to Part 4, Transitional Migration Features) MUST exist from the root of the package (\_rels\.rels) to the part considered to be the Main Part for the package.

2. The content-type for the Main Part must be the same as the MainPartContentType determined in step 5.

6. With the CLSID identified for the embedded package, and the (optional) validation complete in Step 5, the application will activate the embedded package using Windows OLE technologies.

During Save, when an embedded object is encountered, the following procedure is used:

1. The IPersistStorageType for the object is determined by querying the IPersistStorageType registry value under the registry key defined by concatenating HKEY_CLASSES_ROOT\CLSID with the CLSID value for the content-type with "IPersistStorageType". [Example: if the CLSID value for the content-type is "{00020830-0000-0000-C000-000000000046}", then the Windows registry value to query is "HKEY_CLASSES_ROOT\CLSID\{00020830-0000-0000-C000-000000000046}\IPersistStorageType".]

1. If the value does not exist, this procedure is skipped and regular object save will continue.

2. If the value is not 2, this procedure does not apply and regular object save will continue.

3. The object MUST have a "Package" stream or saving the document will fail.

2. The extension to use for the embedded package part will be determined by querying the (default) registry value under the DefaultExtension key under same CLSID path as above. [Example: if the CLSID value for the content-type is "{00020830-0000-0000-C000-000000000046}", then the Windows registry value to query is "HKEY_CLASSES_ROOT\CLSID\{00020830-0000-0000-C000-000000000046}\DefaultExtension\(default)".]

1. If the above value does not exist, saving the document will fail.

2. The registry value will be truncated at the first comma and the first char will be replaced with a '.'. [Example: if the registry value is ".docx, Word Document", the extension will be ".docx"]

3. The content-type to use for the embedded package part will be determined by querying the "Content Type" registry value under the registry key defined by concatenating HKEY_CLASSES_ROOT with the extension determined above. [Example: if the extension is ".docx", then the Windows registry value to query is "HKEY_CLASSES_ROOT\.docx\Content Type".]

1. If the above value does not exist, saving the document will fail.

  1. The "Package" stream in the embedded object is copied into the embedded package part in the main document.