跳到主要内容

GetAlias

返回当前容器的别名属性。

语法

expression.GetAlias();

expression - 表示 ApiBlockLvlSdt 类的变量。

参数

此方法没有任何参数。

返回值

string

示例

读取分配给文档中内容控件的别名。

// 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());