跳到主要内容

GetCategory

返回文档类别。

语法

expression.GetCategory();

expression - 表示 ApiCore 类的变量。

参数

此方法没有任何参数。

返回值

string

示例

从文档的内置核心属性读取类别字段。

// How do I retrieve the category metadata stored in a document?

// Inspect the category to verify or display how a document is classified within a collection in a document.

const doc = Api.GetDocument();
const core = doc.GetCore();
core.SetCategory("Examples");

const category = core.GetCategory();
let paragraph = doc.GetElement(0);
paragraph.AddText("Category: " + category);