fix: a section keeping the document's zones flows on in DOCX

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.
This commit is contained in:
Steffen Becker committed 2026-09-06 20:11:55 +02:00
1 parent 99f10c9399
commit b8afa9d36b
1 file changed
+4 -5
+4 -5
View File
@@ -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 } }