跳到主要内容

PermMark

PermMark

JSSDK: 1.2.0、zOffice2022.3 支持

内容保护文档的可编辑区域对象

属性

name

可编辑区域对象的名称

语法

permMark.name

permMark: 内容保护文档的可编辑区域对象

返回值

name: Promise<string>

示例

async function example() {
const permMark = await Application.ActiveDocument.PermMarks.item(1);
const name = await permMark.name;
}

range

获取可编辑区域所在范围

语法

permMark.range

permMark: 内容保护文档的可编辑区域对象

返回值

Promise<Word.Range>

示例

async function example() {
const permMark = await Application.ActiveDocument.PermMarks.item(1);
const range = await permMark.range;
}

permissionType

JSSDK: 1.9.1、zOffice V8.0 FP1 支持

可编辑区域,对于当前人的权限

语法

permMark.permissionType

permMark: 内容保护文档的可编辑区域对象

返回值

Promise<Word.PermissionType>

示例

async function example() {
const permMark = await Application.ActiveDocument.PermMarks.item(1);
const permissionType = await permMark.permissionType;
}

方法

addEditors

添加可编辑区域用户信息

语法

permMark.addEditors(option)

permMark: 内容保护文档的可编辑区域对象

属性数据类型必填说明
optionanyoption为{"group":["everyone"]}或者{"users": string[]} // 用户ID

返回值

Promise<boolean> 是否添加成功

示例

async function example(app, option) {
let success = false;
const permMark = await Application.ActiveDocument.PermMarks.item(1);
if (permMark) editors = await permMark.addEditors(option);
}

delete

JSSDK: 1.2.2、zOffice2022.3 FP2 支持

删除可编辑区域

语法

permMark.delete()

permMark: 内容保护文档的可编辑区域对象

返回值

Promise<boolean> 是否删除成功

示例

async function example(app) {
let success = false;
const permMark = await Application.ActiveDocument.PermMarks.item(1);
if (permMark) success = await permMark.delete();
}

deleteEditors

JSSDK: 1.2.0、zOffice2022.3 支持

删除可编辑区域用户信息

语法

permMark.deleteEditors(option)

permMark: 内容保护文档的可编辑区域对象

属性数据类型必填说明
optionanyoption为{"group":["everyone"]}或者{"users": string[]} // 用户ID

返回值

Promise<boolean> 是否删除成功

示例

async function example(app, option) {
let success = false;
const permMark = await Application.ActiveDocument.PermMarks.item(1);
if (permMark) success = await permMark.deleteEditors(option);
}

focus

JSSDK: 1.2.21、zOffice2022.3 FP2 hotfix1 支持

定位可编辑区域

语法

permMark.focus()

permMark: 内容保护文档的可编辑区域对象

返回值

Promise<boolean> 是否定位成功

示例

async function example() {
const permMark = await Application.ActiveDocument.PermMarks.item(1);
const success = await permMark.focus();
}

getEditors

获取可编辑区域用户信息

语法

permMark.getEditors()

permMark: 内容保护文档的可编辑区域对象

返回值

Promise<string> 可编辑区域用户信息的Json字符串,有两种格式:

{"group":["everyone"]} 或者 {"users": string[]} // 用户ID

示例

async function example(app) {
let success = false;
const permMark = await Application.ActiveDocument.PermMarks.item(1);
if (permMark) success = await permMark.getEditors();
}

getText

JSSDK: 1.2.21、zOffice2022.3 FP2 hotfix1 支持

获取可编辑区域的文本

语法

permMark.getText()

permMark: 内容保护文档的可编辑区域对象

返回值

Promise<string>

示例

async function example() {
const permMark = await Application.ActiveDocument.PermMarks.item(1);
const success = await permMark.getText();
}

setEditors

设置可编辑区域的可编辑成员信息

语法

permMark.setEditors(option)

permMark: 内容保护文档的可编辑区域对象

属性数据类型必填说明
optionanyoption为{"group":["everyone"]}或者{"users": string[]} // 用户ID

返回值

Promise<boolean> 是否设置成功

示例

async function example(app, option) {
let success = false;
const permMark = await Application.ActiveDocument.PermMarks.item(1);
if (permMark) success = await permMark.setEditors(option);
}

setText

JSSDK: 1.2.21、zOffice2022.3 FP2 hotfix1 支持

设置可编辑区域的文本

语法

permMark.setText()

permMark: 内容保护文档的可编辑区域对象

返回值

Promise<boolean> 文本是否设置成功

参数

属性数据类型必填说明
contentstring可编辑区域的文本

示例

async function example(content) {
const permMark = await Application.ActiveDocument.PermMarks.item(1);
const success = await permMark.setText(content);
}