跳到主要内容

表格块

表格块根数据

{
"id": "ilSh_Ty_2", // Block ID
"type": "table", // Block 类型
"cols": 4, // 列数量
"colsWidth": [ // 每个列宽度(px)
200,
200,
200,
200
],
"rows": 5, // 行数量
// 首行作为标题:true,不作为标题:false(默认)
"hasRowTitle": true,
// 首列作为标题:true,不作为标题:false(默认)
"hasColTitle": true,
// 表格条纹样式(隔行设置背景颜色)
// 设置为 true,显示隔行背景色(默认值:false)
isStripeStyle: false,
// 是否隐藏表格线,设置为 true,隐藏表格线(默认值:false)
noBorder: false,

// 合并单元格应跨越的列数
//(Key:单元格容器 ID + '_colSpan',Value:number)
"hheMfYpft_colSpan": 1,
// 合并单元格应跨越的行数
//(Key:单元格容器 ID + '_rowSpan',Value:number)
"hheMfYpft_rowSpan": 3,

// 合并单元格应跨越的列数
//(Key:单元格容器 ID + '_colSpan',Value:number)
"RVNBKJAvq_colSpan": 2,
// 合并单元格应跨越的行数
//(Key:单元格容器 ID + '_rowSpan',Value:number)
"RVNBKJAvq_rowSpan": 1,

"children": [
// 单元格 ID 集合,顺序为 从左到右,从上到下
"SXW_AfI3X",
"VfVs2SS3J",
"VUHGb4x8v",
"VXMGoCXDM",
"dT7EHN7B6",
"hheMfYpft",
"h7OpqPwOn",
"hgyllJyxb",
"hzfUT8669",
"hV60vXA8J",
"hk8rbdvhA",
"hBa3dIkAl",
"hURX2oteR",
"hij4ilhkM",
"hxTVT40R6",
"hMdes2Pjk",
"RVNBKJAvq"
],
// 单元格背景色
// Key:单元格容器 ID + '_background'
// Value:‘style-bg-color-’ + number, number 范围:[0, 14]
"hV60vXA8J_background": "style-bg-color-3"
}

单元格背景色对应色值

表格块单元格容器数据

{
// 数据与 "blocks" 同级, key 对应 表格块根数据中的 "children"
"hheMfYpft": [
{
"id": "huAMEl1v7", // Block ID
"type": "text", // Block 类型
"text": [
{
"insert": "222"
}
]
},
{
"id": "PtwBNO7gj", // Block ID
"type": "text", // Block 类型
"text": [
{
"insert": "2222"
}
]
},
{
"id": "AHtakplFk", // Block ID
"type": "text", // Block 类型
"text": [
{
"insert": "22222"
}
]
}
],
"blocks": [...]
}

例子

代码

{
"blocks": [
{
"id": "eGWCxv9yH",
"type": "text",
"text": [
{
"insert": "Table Demo"
}
],
"heading": 1,
"quoted": false
},
{
"id": "ilSh_Ty_2",
"type": "table",
"cols": 4,
"colsWidth": [
200,
200,
200,
200
],
"hheMfYpft_colSpan": 1,
"hheMfYpft_rowSpan": 3,
"rows": 5,
"hasRowTitle": true,
"hasColTitle": true,
"RVNBKJAvq_colSpan": 2,
"RVNBKJAvq_rowSpan": 1,
"children": [
"SXW_AfI3X",
"VfVs2SS3J",
"VUHGb4x8v",
"VXMGoCXDM",
"dT7EHN7B6",
"hheMfYpft",
"h7OpqPwOn",
"hgyllJyxb",
"hzfUT8669",
"hV60vXA8J",
"hk8rbdvhA",
"hBa3dIkAl",
"hURX2oteR",
"hij4ilhkM",
"hxTVT40R6",
"hMdes2Pjk",
"RVNBKJAvq"
],
"hV60vXA8J_background": "style-bg-color-3"
},
{
"id": "jsAhr26pa",
"type": "text",
"text": []
}
],
"dT7EHN7B6": [
{
"id": "d0kB1EtCP",
"type": "text",
"text": [
{
"insert": "B1"
}
]
}
],
"hheMfYpft": [
{
"id": "huAMEl1v7",
"type": "text",
"text": [
{
"insert": "222"
}
]
},
{
"id": "PtwBNO7gj",
"type": "text",
"text": [
{
"insert": "2222"
}
]
},
{
"id": "AHtakplFk",
"type": "text",
"text": [
{
"insert": "22222"
}
]
}
],
"h7OpqPwOn": [
{
"id": "hxsRITMKd",
"type": "text",
"text": [
{
"insert": "333"
}
]
}
],
"hgyllJyxb": [
{
"id": "hduRmtGD7",
"type": "text",
"text": [
{
"insert": "444"
}
]
}
],
"hzfUT8669": [
{
"id": "hs6w_8O8A",
"type": "text",
"text": [
{
"insert": "B2"
}
]
}
],
"hV60vXA8J": [
{
"id": "hFU1TVkqS",
"type": "text",
"text": [
{
"insert": "666"
}
]
}
],
"hk8rbdvhA": [
{
"id": "hVZJ0Fgui",
"type": "text",
"text": [
{
"insert": "777"
}
]
}
],
"hBa3dIkAl": [
{
"id": "h5gBDdoiP",
"type": "text",
"text": [
{
"insert": "B3"
}
]
}
],
"hURX2oteR": [
{
"id": "hCSZMYucS",
"type": "text",
"text": [
{
"insert": "999"
}
]
}
],
"hij4ilhkM": [
{
"id": "hdceiPFGy",
"type": "text",
"text": [
{
"insert": "000"
}
]
}
],
"hxTVT40R6": [
{
"id": "hAUSUggOO",
"type": "text",
"text": [
{
"insert": "B4"
}
]
}
],
"hMdes2Pjk": [
{
"id": "hPrBtwVFa",
"type": "text",
"text": [
{
"insert": "bbb"
}
]
}
],
"SXW_AfI3X": [
{
"id": "S4z0Tptqs",
"type": "text",
"text": [
{
"insert": "A/B"
}
]
}
],
"VUHGb4x8v": [
{
"id": "VMJXdiTWQ",
"type": "text",
"text": [
{
"insert": "A2"
}
]
}
],
"VXMGoCXDM": [
{
"id": "V3TfTxz3O",
"type": "text",
"text": [
{
"insert": "A3"
}
]
}
],
"VfVs2SS3J": [
{
"id": "VSkex9Pws",
"type": "text",
"text": [
{
"insert": "A1"
}
]
}
],
"RVNBKJAvq": [
{
"id": "RIt5DjwMW",
"type": "text",
"text": [
{
"insert": "ccc"
}
]
}
]
}