SetIdentifier
设置文档标识符。
语法
expression.SetIdentifier(sIdentifier);
expression - 表示 ApiCore 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| sIdentifier | 必需 | string | 文档标识符。 |
返回值
此方法不返回任何数据。
示例
通过电子表格的文档属性为工作簿分配唯一标识符。
// How do I tag a workbook with a unique ID in a spreadsheet?
// Label the workbook with a custom reference code stored in its metadata in a spreadsheet.
const worksheet = Api.GetActiveSheet();
const core = Api.GetCore();
core.SetIdentifier("#ID42");
const identifier = core.GetIdentifier();
let fill = Api.CreateSolidFill(Api.RGB(100, 50, 200));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = worksheet.AddShape(
"rect",
100 * 36000, 100 * 36000,
fill, stroke,
0, 0, 3, 0
);
let paragraph = shape.GetContent().GetElement(0);
paragraph.AddText("Identifier: " + identifier);