Created attachment 167206 [details] Example file from Word Attached user made file contains two paragraphs formatted as Heading 2, which happens to has a border under the paragraph. When the Heading 2 is applied to an empty paragraph that only has a page break in it, Word does not draw the border, while Writer does, making a page wide line appear out of thin air. Steps to reproduce: 1. Open attached file Actual results: Extra horizontal line below the text. Expected results: No extra line. Also: Word draws the line once a visible character is entered in that line left of the ---Page Break--- mark so maybe this behavior is to be imitated. LibreOffice details: Version: 7.1.0.0.alpha1+ (x64) Build ID: 00e5c63c35307faacf76a5e2ca7953c4208244ed CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win Locale: hu-HU (hu_HU); UI: en-US Calc: CL Also in: Version: 6.0.0.3 Build ID: 64a0f66915f38c6217de274f0aa8e15618924765 CPU threads: 4; OS: Windows 6.3; UI render: default; Locale: en-US (hu_HU); Calc: CL Version: 5.0.0.5 Build ID: 1b1a90865e348b492231e1c451437d7a15bb262b Locale: hu-HU (hu_HU) Verzió: 4.0.0.3 (Build az.: 7545bee9c2a0782548772a21bc84a9dcc583b89) LibreOffice 3.5.0rc3 Build ID: 7e68ba2-a744ebf-1f241b7-c506db1-7d53735
Created attachment 167207 [details] Screenshot of the original document side by side in Word and Writer
Confirmed with document Arch Linux 64-bit Version: 7.1.0.0.alpha1+ Build ID: bd3aeaefff5e7bdef10c4702d1f388083557614e CPU threads: 8; OS: Linux 5.9; UI render: default; VCL: kf5 Locale: fi-FI (fi_FI.UTF-8); UI: en-US Calc: threaded Built on 15 November 2020
It is an emulation thing. Word treats the page break as a carriage return, while LO doesn't, so it needs to insert a CR (with all that entails). We need to clear numbering in a similar way IIRC. Searching for "bRemove" should get you in the right area of the code.
Created attachment 187236 [details] emptypara-skippedNumbering.docx: even numbering is not shown repro 7.6+ compatibilityMode 15, but does the same thing in Word 2010. And look at this: the "invisible" heading line even ignores numbering while still being affected by it. (At least in Word 2010 this has headings 1. and 3.)
The conversation and fixes for bug 153964 are probably critical here, specifically https://gerrit.libreoffice.org/c/core/+/148452. -a comment in gerrit indicates I intentionally ignored borders.
For something minor and extremely odd like this, it is probably better to fix the document than the code.