Skip to content

DOCXKIT_TABLE_INVALID_COLUMNS: 表格网格无效 ​

表格没有列,或单元格跨度无效、重叠、超出边界。

修复步骤 ​

  1. 至少定义一列。
  2. 将 rowSpan 和 colSpan 限制在网格范围内,移除重叠的单元格位置。

问题示例 ​

ts
// Invalid table grid: no columns.
const columns = []

修复示例 ​

ts
import { createDocx } from 'docx-kit'

const blob = await createDocx().table({
  columns: [{ key: 'name', title: 'Name' }],
  data: [{ name: 'Ada' }],
}).toBlob()

常见原因 ​

  • 列定义为空,或单元格跨度超出网格、互相重叠。

诊断字段 ​

消息示例 ​

text
Table must have at least one column

源码与相关指南 ​

Released under the MIT License.