DOCXKIT_STYLE_UNKNOWN_CLASS: Unknown style class
A className or extends reference does not match a stylesheet key.
What to do
- Compare the referenced class with the exact stylesheet keys.
- 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
code:STYLE_UNKNOWN_CLASSdiagnosticCode:DOCXKIT_STYLE_UNKNOWN_CLASSname:DocxKitErrordocs: https://docx-kit.ntnyq.dev/errors/docxkit_style_unknown_class/
Example message
text
Style class not found: "boddy"