跳到主要内容

GetAllOleObjects

Returns all OLE objects from the current sheet.

Syntax

expression.GetAllOleObjects();

expression - A variable that represents a ApiWorksheet class.

Parameters

This method doesn't have any parameters.

Returns

ApiOleObject[]

Example

This example shows how to get all OLE objects from the sheet.

// How to get all OLE objects images.

// Get all OLE objects as an array.

let worksheet = Api.GetActiveSheet();
worksheet.AddOleObject(
'https://static.onlyoffice.com/assets/docs/samples/img/onlyoffice_logo.png',
150 * 36000, 150 * 36000,
'https://youtu.be/SKGz4pmnpgY',
'asc.{38E022EA-AD92-45FC-B22B-49DF39746DB4}',
0, 2 * 36000, 4, 3 * 36000
);
let oleObjects = worksheet.GetAllOleObjects();
let appId = oleObjects[0].GetApplicationId();
worksheet.GetRange('A1').SetValue('The application ID for the current OLE object: ' + appId);