David Gausmann David Gausmann - 22 days ago 11
C++ Question

OLE: Shared IStorage for multiple OLE objects?

I am currently implementing an IOleObject interface to embed visualized data of our software into other software like PowerPoint. Our software creates graphical evaluations of measured data (diagrams, etc.).
The goal is, that the end-user can make a double click on the embedded OLE object to edit it in our software. The data will be stored using the given IStorage interface in IPersistStorage::Save/Load. The measured data must be embedded, not linked.

My current solution works fine, but the problem is, that the embedded data will be saved once per OLE object. In example we have got 10 MB of measured data and the end-user embeds fifty different diagrams of that measured data into PowerPoint, the measured data will be embedded fifty times in the PowerPoint file (50 * 10 MB = 500 MB, although 10 MB per PowerPoint file would be enough).

My question is if there exists any shared IStorage interface for the entire container(?) or something similiar?

The given IStorage interfaces in IPersistStorage::Load/Save depends only on the specific, embedded OLE object.
It would be great if I could tell the host application something like "PowerPoint, my fifty OLE objects share that IStorage there. Please save it only once in the PPTX file."

Answer

No, that's the way OLE embedding is supposed to work. Each object gets its own storage in the container. If it's the same object with the same data, why does it need to be embedded 50 times? If it's the same object and you want it to be be on different pages in the presentation, why not embed the first instance and make all the remaining instances links? That would save storage. Of course, if you delete the first embedded instance, all the links will turn to ....

Comments