描述

获取表格内数据。

  • 自动跳过标题行

接口

object GetTableProperties(string tableId, object cfg)

参数

参数名 必填 类型 说明 备注
tableId string 表格ID,为””时表示当前操作表格
cfg object 控制参数

cfg-参数

参数名 必填 类型 说明 备注
buildAttribute bool 获取table、row、cell全部属性 0:否 1:是
buildText bool 获取cell文本 0:否 1:是
buildFragment bool 获取cell片段 0:否 1:是

参数示例

thinkEditor.GetTableProperties("tableId",{
    buildText : true,
    buildFragment : true
});

返回值

{
    "id": "",
    "name": "",
    "rowsCount": 7,
    "colsCount": 4,
    "rows": [
        {
            "rowIdx": 0,
            "cells": [
                {
                    "id": "",
                    "name": "",
                    "rowIdx": 0,
                    "colIdx": 0,
                    "text": "姓名11\r\n12\r\n3\r\n4",
                    "fragment": "<Paragraph><Annotate id='uka3lGeHE008' type='0' state='1'\/>姓名<Annotate id='uka3lGeHE008' state='0'\/>11<\/Paragraph><Paragraph>12<LF\/>3<LF\/>4<\/Paragraph>"
                },
                {
                    "id": "",
                    "name": "",
                    "rowIdx": 0,
                    "colIdx": 1,
                    "text": "张小66",
                    "fragment": "<Paragraph><Element id='name' cfg='30000' xCfg='1' hint='请输入' sourceClass='基本资料' sourceId='姓名'>张小66<\/Element><\/Paragraph>"
                },
                {
                    "id": "",
                    "name": "",
                    "rowIdx": 0,
                    "colIdx": 2,
                    "text": "职业",
                    "fragment": "<Paragraph>职业<\/Paragraph>"
                },
                {
                    "id": "",
                    "name": "",
                    "rowIdx": 0,
                    "colIdx": 3,
                    "text": "技术人员",
                    "fragment": "<Paragraph><Element cfg='30000' inputMode='2' optionClass='系统' optionId='职业A' linkStr='、' hint='请选择'>技<Feature lockOptId='2567' cfg='1'\/>术人<Feature lockOptId='' cfg='0'\/>员<\/Element><\/Paragraph>"
                }
            ]
        }
    ]
}
文档更新时间: 2025-05-30 15:44   作者:admin