Bug 166510 - FILEOPEN DOCX: paragraph before section page break has wrong bottom spacing
Summary: FILEOPEN DOCX: paragraph before section page break has wrong bottom spacing
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
25.2.3.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, filter:doc, filter:docx
Depends on:
Blocks: DOCX-Paragraph DOC-Paragraph
  Show dependency treegraph
 
Reported: 2025-05-09 21:27 UTC by Justin L
Modified: 2025-05-12 14:38 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
forum-mso-en-14884.docx: a simple example document (15.44 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-05-09 21:27 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2025-05-09 21:27:40 UTC
Created attachment 200718 [details]
forum-mso-en-14884.docx: a simple example document

My 25.8 commit 9a8eb2dc17435d290f482070dd5f20f538b5b68b (backported to 25.2.3)
    tdf#165047 sw mso-compat layout: always consolidate top margin
correctly reduces the top margin of the paragraph-after-a-page-break by the previous paragraph's bottom spacing.

IIUC, we never create a CR marker for an empty sectPr paragraph, and thus LO throws away the bottom-spacing of the sectPr paragraph - although this has the setting that informs the paragraph-after-the-section-page-break how much it needs to consolidate from its top spacing.

Since the bottom spacing of the paragraph-before-an-empty-sectPr will end up being irrelevant, we should just be able to replace it with the sectPr's bottom spacing at import time.

Steps to reproduce
1.) open the 2-page forum-mso-en-14884.docx

After the page break, there should be a 12pt (0.42cm) gap between the header and "Chapitre 1" (since the Heading 1's 12pt before-spacing should be consolidated with Heading 1's 0pt after-spacing instead of Normal's 8pt after-spacing).

<w:p>
  <w:pPr>
    <w:pStyle w:val="Titre1"/> ...
    <w:sectPr/>
  </w:pPr>

<w:style w:type="paragraph" w:styleId="Titre1">
  <w:name w:val="heading 1"/>
  <w:pPr>
    <w:spacing w:before="240" w:after="0"/>
  </w:pPr>

There are many more examples:
-forum-mso-de-88983.docx: notable - it should consolidate by 18pt instead of 8pt
-forum-mso-de-102317.docx: consolidate 30pt with 24pt instead of 6pt
-forum-mso-de-103594.docx: w:spacing w:after="0" w:line="276" w:lineRule="auto"/
-forum-mso-de-60094.docx: page 5
-forum-mso-de-63307.docx: page 7 
-forum-mso-de-67370.docx: page 2. Other pages with normal breaks were fixed...
-forum-mso-de-69658.docx: page 8
-forum-mso-de-74815.docx: page 6. not an empty sectPr
-forum-mso-en-13355.docx: page 2 - all "Normal" styles
-forum-mso-en-17432.docx: page 3
-forum-mso-en-2676.docx: page 2, 5
-forum-mso-en3-19156.docx: page 4 only

DOC EXAMPLES
-forum-mso-en-2256.doc: page 4 and 8
-ooo112024-1.doc: page 2
-ooo98045-2.doc: page 7, 8: consolidate 17pt with 0pt instead of 17pt.

Found by Collabora's mso-test