DOCXKIT_HEADER_FOOTER_INVALID_CONTENT: Invalid header or footer output
A header/footer plugin returned an element other than a Paragraph or Table.
What to do
- Return Paragraph or Table instances for header and footer content.
- Wrap inline runs inside a Paragraph.
Problem example
ts
import { TextRun } from 'docx'
// Invalid output from a plugin used in a header/footer:
const render = () => new TextRun('Header')Corrected example
ts
import { Paragraph, TextRun } from 'docx'
// Valid output from a plugin used in a header/footer:
const render = () => new Paragraph({ children: [new TextRun('Header')] })Common causes
- A plugin returned a bare TextRun or another unsupported child element.
Diagnostic fields
code:HEADER_FOOTER_INVALID_CONTENTdiagnosticCode:DOCXKIT_HEADER_FOOTER_INVALID_CONTENTname:DocxKitErrordocs: https://docx-kit.ntnyq.dev/errors/docxkit_header_footer_invalid_content/
Example message
text
Header and footer plugins must render paragraphs or tables