Skip to main content

Sections

Sections

JSSDK: 1.4.1、zOffice V7.0 FP1支持

文档中的所有节对象集合。

属性

count

获取文档中所有节的总数。

语法

Sections.count

返回值

Promise<number>

示例

async function example() {
const sections = await Application.ActiveDocument.Sections;
const count = await sections.count;
}

first

获取文档中第一节。

语法

Sections.first

返回值

Promise<Word.Section>

示例

async function example() {
const sections = await Application.ActiveDocument.Sections;
const first = await sections.first;
}

last

获取文档中最后一节。

语法

Sections.last

返回值

Promise<Word.Section>

示例

async function example() {
const sections = await Application.ActiveDocument.Sections;
const last = await sections.last;
}

方法

item

代表文档中的单个节,返回Section对象

语法

Application.ActiveDocument.Sections.item(index)

Application: 文档类型应用对象

参数

属性数据类型必填说明
indexnumber节的序号(序号从1开始)

返回值

Promise<Word.Section>

示例

async function example() {
const section = await Application.ActiveDocument.Sections.item(1);
}