跳到主要内容

GetCustomProperties

返回工作簿的自定义属性。

语法

expression.GetCustomProperties();

expression - 表示 ApiWorkbook 类的变量。

参数

此方法没有任何参数。

返回值

ApiCustomProperties

示例

此示例演示如何获取工作簿的 ApiCustomProperties 对象

const workbook = Api.GetActiveWorkbook();
const customProps = workbook.GetCustomProperties();
customProps.Add("MyStringProperty", "Hello, Spreadsheet!");
let stringValue = customProps.Get("MyStringProperty");

const worksheet = workbook.GetActiveSheet();
worksheet.GetRange('A1').SetValue(stringValue);