跳到主要内容

GetInternalId

返回当前文档内容的内部 ID。

语法

expression.GetInternalId();

expression - 表示 ApiDocumentContent 类的变量。

参数

此方法没有任何参数。

返回值

string

示例

获取电子表格中形状内文档内容元素的内部标识符。

// How can I get the internal id using a document content in a spreadsheet?

// Get the internal id for a document content in a spreadsheet.

const worksheet = Api.GetActiveSheet();
const fill = Api.CreateSolidFill(Api.RGB(89, 130, 190));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = worksheet.AddShape(
'rect',
Api.MillimetersToEmus(70), Api.MillimetersToEmus(25),
fill, stroke,
0, 0, 3, 0
);
const content = shape.GetContent();
const internalId = content.GetInternalId();
worksheet.GetRange('A1').SetValue('Internal ID: ' + internalId);