Skip to main content

GetInternalId

Returns an internal ID of the current document content.

Inherited from ApiDocumentContent.GetInternalId.

Example

Retrieve the unique internal ID of a document content object in a document.

// How do I get the internal identifier assigned to a document content in a document?

// Display the internal ID inside a shape to track or reference that content container later.

const doc = Api.GetDocument();
const paragraph = doc.GetElement(0);

const fill = Api.CreateSolidFill(Api.RGB(70, 130, 180));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const drawing = Api.CreateShape('rect', Api.MillimetersToEmus(100), Api.MillimetersToEmus(60), fill, stroke);
paragraph.AddDrawing(drawing);

const docContent = drawing.GetContent();
const internalId = docContent.GetInternalId();

const shapeParagraph = docContent.GetElement(0);
shapeParagraph.AddText('Document content internal ID: ' + internalId);