Object embedding in Open XML

There were some concerns raised earlier on that the Open XML format required a specific object embedding to be used (OLE). While it's true that the tag names in the format have "OLE" in them, the embedding is actually generic, and can use other technologies if that's what's desired. I believe (but I'm not positive) that this is also true for ODF's draw:object-ole element.

Eric White has a blog post that demonstrates how to embed a KPart on a Linux machine and store that in the Open XML format: http://blogs.msdn.com/ericwhite/archive/2008/03/10/spreadsheet-simulation-demonstrating-an-embedded-kpart-on-linux.aspx

It's pretty cool… he created a mini spreadsheet application that reads in an xlsx file with an embedded HTML viewer KPart. The application displays the values in the cells, along with the embedded object.


Comments (10)

  1. orcad says:

    Can you embed proprietary code in there?

  2. Dr. Tusk says:

    Unfortunately, like ODF, there is no standard mechanism for indicating the actual format of the object, whether linked or embedded. The consumer of the document has to guess whether it’s an IStorage, KLINK, or something else.

  3. Ian Easson says:

    Dr. Tusk,

    Are you sure of this?  Brian, any comments?

  4. Ian, Tusk,

    The indication of which type of object is actually embedded in the package is normally persisted in the "progId"-attribute of the oleObject/externalLink/OleObj/OleOject-element.

  5. DrTusk says:

    Unfortunately, the ProgId doesn’t help. Unless I am mistaken, there is no standard way to map a ProgId to an object format. The object could be a Win32 IStorage, linux KPart, an OOXML zip package, an ODF zip package, an OOXML flat xml, an ODF flat xml, or something else. Short of only supporting a hard-coded list of well-known types, I still need to sniff the object.

  6. jones206@hotmail.com says:

    One thing to note is that the preferred approach for embedding is to identify the content type of the embedded object using the standard OPC conventions. There is of course a generic content type for objects where you should instead look at the progID, but as folks have pointed out this isn’t optimal.

    Office 2007 does this when you embed an .xlsx within a .docx for example.


  7. DrTusk says:

    That is true, although you failed to mention that Office 2007 also uses a different relationship when it embeds an xlsx in a docx. It seems then the relationship defines the storage format of the embedded object.

    Therefore, to store a raw ODT zip file as an embedded object, it seems I should invent a new relationship type that indicates the embedded object is an ODF-compliant zip file, and use the content type to describe the contents (e.g. ODT vs. ODS).

  8. jones206@hotmail.com says:


    Close, but not quite… there are only two relationship types. One is used in the generic case where there is no specific content type; and the other is used when there is a content type specified.

    The relationship type “http://schemas.openxmlformats.org/officeDocument/2006/relationships/package“ indicates that it is a standalone file and you can look at the content type to determine what type of file it is.


  9. DrTusk says:

    Hmm, I was under the impression this relationship type implied the target is an OOXML package. If this is not the case, embedding a .DOC in a .DOCX should also use this "package" relationship, since the embedded .DOC is a standalone file and a specific content-type is provided.

    On the same note, is it valid to embed an ODT file in DOCX using the "package" relationship type and appropriate content type? Office 2007 says such a file is corrupt.

Skip to main content