Skip to content

DOCXKIT_PREVIEW_INPUT_INVALID: 预览输入无效 ​

预览输入缺失,或类型不受支持。

修复步骤 ​

  1. 传入 DOCX Blob、ArrayBuffer、Uint8Array 或 URL。
  2. 生成完成后再开始预览。

问题示例 ​

ts
// Invalid external input:
const input = null

修复示例 ​

ts
import { createDocx, createDocxPreview } from 'docx-kit'

const container = document.createElement('div')
document.body.append(container)

const preview = createDocxPreview(container)
try {
  await preview.render(await createDocx().p('Hello').toBlob())
} finally { preview.destroy() }

常见原因 ​

  • 传入 null,或不支持的对象、字符串类型。

诊断字段 ​

消息示例 ​

text
Unsupported preview input type

源码与相关指南 ​

Released under the MIT License.