ExcelScript.AllowEditRangeOptions interface
用于构造 对象的可选字段的 AllowEditRange
接口。
注解
示例
/**
* This script adds a password-protected, editable range
* to an otherwise protected worksheet.
*/
function main(workbook: ExcelScript.Workbook, password: string) {
// Get the protection object for the "Data" worksheet.
const dataSheet = workbook.getWorksheet("Data");
const sheetProtection = dataSheet.getProtection();
// Set the password needed to edit the range to be the user provided string.
const editRangeProperties : ExcelScript.AllowEditRangeOptions = {
password: password
};
// Set range "D2:D6" to be editable if the password is provided.
sheetProtection.addAllowEditRange("Notes Section", "D2:D6", editRangeProperties);
// Protect the worksheet.
sheetProtection.protect();
}
属性
password | 与 |
属性详细信息
password
与 AllowEditRange
关联的密码。
password?: string;
属性值
string