Skip to main content

GetAlias

Returns the alias attribute for the current container.

Syntax​

expression.GetAlias();

expression - A variable that represents an ApiBlockLvlSdt class.

Parameters​

This method doesn't have any parameters.

Returns​

string

Example​

Read the alias name assigned to a content control in a document.

// How do I retrieve the alias of a content control in a document?

// Display the alias label of a content control as visible text in a document.

let doc = Api.GetDocument();
let blockLvlSdt = Api.CreateBlockLvlSdt();
blockLvlSdt.GetContent().GetElement(0).AddText("This is a block text content control with alias 'ONLYOFFICE'.");
blockLvlSdt.SetAlias("ONLYOFFICE");
doc.AddElement(0, blockLvlSdt);
doc.GetElement(1).AddText("Alias: " + blockLvlSdt.GetAlias());