From b8afa9d36bb89a57ed1bf364825e1a5ab0c0e51b Mon Sep 17 00:00:00 2001 From: Steffen Becker Date: Sun, 6 Sep 2026 19:44:26 +0200 Subject: [PATCH] fix: a section keeping the document's zones flows on in DOCX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A body sectPr without w:type means nextPage, so every section break started a page the editor and the ODT export never make — the DOCX import then read that break back as fo:break-before. It is continuous now unless the section has zones or a page setup of its own, which is exactly when odt.ts mints it a master page. Measured on LibreOffice 24.2: the kitchen sink paginates to five pages in both formats again. --- src/lib/export/docx.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/export/docx.ts b/src/lib/export/docx.ts index a23d904..23419df 100644 --- a/src/lib/export/docx.ts +++ b/src/lib/export/docx.ts @@ -3036,14 +3036,13 @@ export async function buildDocx( // 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 } : {}), - // A section that must open on a right or left page says so here; Word inserts - // the blank page for it, as LibreOffice does for style:page-usage. Any other - // section begins a page (the default), as naming a master page does in ODF; - // only a columns group inside a section flows on. + // A section that must open on a right or left page says so here. One with zones + // or a page setup of its own begins a page, as its master page does in ODF; one + // with neither flows on, as the editor lays it out — like a columns group does. ...(i > 0 && groups.findIndex((x) => x.section === g.section) === i ? (setAt(g.section).startsOn ? { type: setAt(g.section).startsOn === 'odd' ? SectionType.ODD_PAGE : SectionType.EVEN_PAGE } - : {}) + : g.section < hfSets.length ? {} : { type: SectionType.CONTINUOUS }) : i > 0 ? { type: SectionType.CONTINUOUS } : {}), ...(g.columns ? { column: { count: g.columns.count, space: cmToTwip(g.columns.gapCm), equalWidth: true } }