From 9d6f0bebb9ce70d320731e10afacc4e31f60e5e8 Mon Sep 17 00:00:00 2001 From: Steffen Becker Date: Fri, 28 Aug 2026 17:07:57 +0000 Subject: [PATCH] fix: titlePg only on the section group that begins its header set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A continuous section pushed onto a fresh page by a page break repeated titlePg, and Word blanks a titlePg section's first page — the running header, footer and watermark vanished from that page. --- src/lib/export/docx.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/export/docx.ts b/src/lib/export/docx.ts index 5600bcf..9a46fc5 100644 --- a/src/lib/export/docx.ts +++ b/src/lib/export/docx.ts @@ -2664,9 +2664,11 @@ export async function buildDocx( } } : {}), // Word blanks a titlePg section's first page when no w:type="first" header is - // referenced, and every section restarts that logic — so a section merely - // reusing the last set through the clamp must not repeat titlePg. - ...(setAt(g.section).differentFirstPage && g.section < hfSets.length ? { titlePage: true } : {}), + // referenced, and every section restarts that logic — even a continuous one + // that a page break pushes onto a fresh page. So only the group that begins + // its header set carries titlePg; later groups of the set must not repeat it. + ...(setAt(g.section).differentFirstPage && g.section < hfSets.length + && groups.findIndex((x) => x.section === g.section) === i ? { titlePage: true } : {}), ...(i > 0 && !(setAt(g.section).pageNumberStart != null && groups.findIndex((x) => x.section === g.section) === i) ? { type: SectionType.CONTINUOUS } : {}), ...(g.columns