How to: get Ole object id / find object by id


Is there any way to get id of an ApiOleObject or find object by id (for example, on slide)?
I wanted to use object id to make some sort of link between ole objects to update linked when one of them is changed (by user via my plugin).
So, the problem is to find related objects in the document in order to update them (I need to read the ole object instance data to perform the update).
I could check data of every ole object in document, but it might have a significant impact on performance.

Hi there!
Let’s see if I can find something to help you.

Hello, @scoolnik :wave:

We have three plugin methods that can help: AddOleObject, GetSelectedOleObjects, and EditOleObject.

Here’s what you can do:

  1. Use the AddOleObject method to add an OLE object.
  2. As a callback for AddOleObject you can utilize function with GetSelectedOleObjects method to return an array of newly added objects
  3. Retrieve the objectId from this array.
  4. During the editing session, you can use objectId to edit the object via the EditOleObject method.

Example code:

window.Asc.plugin.executeMethod ("AddOleObject", [_param], function() {
            //call GetSelectedOleObjects here


This way, you don’t need to check the data of every OLE object in the document, which will significantly improve the performance of your plugin.

1 Like