Skip to content

DOCXKIT_STYLE_UNKNOWN_CLASS: Unknown style class ​

A className or extends reference does not match a stylesheet key.

What to do ​

  1. Compare the referenced class with the exact stylesheet keys.
  2. Define missing parent classes before calling defineStyles.

Problem example ​

ts
import { defineStyles } from 'docx-kit'

defineStyles({ body: { extends: 'missing' } })

Corrected example ​

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

const styles = defineStyles({ body: { fontSize: 12 } })
const blob = await createDocx({ styles })
  .p('Hello', { className: 'body' })
  .toBlob()

Common causes ​

  • A spelling mismatch, missing parent style, or wrong stylesheet.

Diagnostic fields ​

Example message ​

text
Style class not found: "boddy"

Released under the MIT License.