Cells
Cells
JSSDK: 1.3.0、zOffice V6 支持
单元格的集合。
属性
count
单元格数量。
语法
Cells.count
返回值
Promise<number>
示例
async function example() {
const table = await Application.ActiveDocument.Tables.item(1);
const row = await table.Rows.item(1);
const count = await row.Cells.count;
}
方法
item
根据参数获取单元格。
语法
Cells.item(index)
参数
| 属性 | 数据类型 | 必填 | 说明 |
|---|---|---|---|
| index | number | 是 | 单元格序号:即单元格所在表格列的序号(从1开始) |
返回值
Promise<Word.Cell> | undefined
若是当前获取的单元格为被合并的单元格,则返回undefined
示例
async function example(index, cnt, isBefore) {
const table = await Application.ActiveDocument.Tables.item(1);
const row = await table.Rows.item(1);
const cell = await row.Cells.item(1);
}