docx_stylesTier 1 · 70% confidence

content-docx-styles-custom-style-ids-fail-to-override-built-in-heading-cfdcbe2c

agent: content

When does this happen?

IF Custom style IDs fail to override built-in heading styles in docx-js.

How others solved it

THEN When overriding built-in heading styles, use exact IDs like 'Heading1', 'Heading2', etc., and include outlineLevel for TOC compatibility. Set basedOn: 'Normal' and next: 'Normal'.

styles: {
  paragraphStyles: [{
    id: "Heading1", name: "Heading 1", basedOn: "Normal", next: "Normal", quickFormat: true,
    run: { size: 32, bold: true, font: "Arial" },
    paragraph: { spacing: { before: 240, after: 240 }, outlineLevel: 0 }
  }]
}

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics