To follow up on this for the benefit of the community, @Has and I worked offline to determine the missing pieces needed for package embedding in Office.
I will summarize what was needed for this poster's specific scenario, removing company, project or personally specific information. Regarding the more generalized documentation, there will be some updates needed in our MS-OI29500: Office Implementation Information for ISO/IEC 29500 Standards Support specification and I'll file a bug to get these added.
NOTE 1: for this scenario, Visio was the main Office app of interest but the following should apply to Word, PowerPoint and Excel as well.
NOTE 2: there is a check in Office for the specific "main part content type" and some hard coded expectations as you see below. The Office team has filed a bug (which is fixed and in the pipeline for publishing but no ETA right now) to remove that check which should allow for main part content types to be other than officeDocument.
In this scenario, the OP's OLE server object is an inprocserver32 based object (i.e. DLL) and other than that is a basic OLE document server that uses an OPC (Open Packaging Convention) XML format for it's document persistence.
Registration for the object should be similar to below (shown for
InprocServer32). Pay attention to the MainPartContentType
and extension
information ( .zirt
and Extension
):
HKCR
{
MIME
{
Database
{
'Content Type'
{
application/zirt
{
val CLSID = s '{558d5b9b-36c2-4f29-ad9d-f563a8ce107d}'
val Extension = s '.zirt'
}
}
}
}
.zirt = s 'EmbedToOffice.EmbedToOfficeObj'
{
val 'Content Type' = s 'application/zirt'
}
EmbedToOffice.EmbedToOfficeObj = s 'EmbedToOfficeObj class'
{
CLSID = s '{558d5b9b-36c2-4f29-ad9d-f563a8ce107d}'
Insertable
}
NoRemove CLSID
{
ForceRemove {558d5b9b-36c2-4f29-ad9d-f563a8ce107d} = s 'EmbedToOfficeObj class'
{
ProgID = s 'EmbedToOffice.EmbedToOfficeObj'
VersionIndependentProgID = s 'EmbedToOffice.EmbedToOfficeObj'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
ForceRemove Insertable
MiscStatus = s '0'
val IPersistStorageType = d '2'
val MainPartContentType = s 'application/xml'
AuxUserType
{
2 = s 'EmbedToOffice.EmbedToOfficeObj'
3 = s 'EmbedToOfficeObj class'
}
DefaultExtension = s '.zirt, EmbedToOfficeObj class (*.zirt)'
DataFormats
{
DefaultFile = s 'xml'
}
}
}
}
In the package that the object creates (i.e. it's document content), the _rels/.rels
part will need to look like the below. Pay attention to the Relationship Type attribute for the main part relationship (in this case rId1):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns=http://schemas.openxmlformats.org/package/2006/relationships>
<Relationship Id="rId1" Type=http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument Target="MyAppZurt/MyAppZurt.xml"/>
</Relationships>
UPDATE: recently we found that Office will skip the check for the
http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument
relationship if the MainPartContentType registry entry is omitted. This means that you can use a custom (i.e. non-Microsoft) relationship type instead.
Best regards,
Tom Jebo
Sr Escalation Engineer
Microsoft Open Specifications Support