Bug 148057 - FILEOPEN DOCX Column break disappears in 1 column per page document
Summary: FILEOPEN DOCX Column break disappears in 1 column per page document
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.4.0.3 release
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:26.2.0
Keywords: implementationError
Depends on:
Blocks: DOCX-Page
  Show dependency treegraph
 
Reported: 2022-03-17 17:19 UTC by Gabor Kelemen (allotropia)
Modified: 2025-08-20 00:46 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
The example file in Word and Writer master (96.63 KB, image/png)
2022-03-17 17:20 UTC, Gabor Kelemen (allotropia)
Details
Subscription Agreement_minimized.docx: minimal reproducer (525.77 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-08-19 20:10 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2022-03-17 17:19:16 UTC
This is a continuation of bug 146851

When attachment 177662 [details] is opened, there should be a page break before the " 
Schedule 2 Particulars of the Company [and the Subsidiaries]" part around page 24.

1, Open attachment 177662 [details] 
2, Note the layout of the "Schedule 2 Particulars of the Company" text: in Word there is a column break before it, working as a page break, in Writer it is on the previous page of "Schedule 1 Particulars of the Investors and the Founders"

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: cfd82e7a2cc2b45b738eb0efa0827196d2de61a4
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: hu-HU (hu_HU.UTF-8); UI: hu-HU
Calc: threaded

Started to look like this in 4.4, in range:

https://cgit.freedesktop.org/libreoffice/core/log/?qt=range&q=27b1ddff407df7bbabf51096147cf58372ad861c..af748c7fff9e57a5b95bdc569456cc0da93a1f90

of which this commit stands out as suspicious:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=382bab9412b87f82da82276332496eb28b28d4f3

author	Miklos Vajna <vmiklos@collabora.co.uk>	2014-10-20 14:43:42 +0200
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2014-10-20 15:23:50 +0200
commit 382bab9412b87f82da82276332496eb28b28d4f3 (patch)

DOCX import: fix <w:pageBreakBefore> wrt. inherited styles

Before the commit range there was a whole empty page in place of the column break, so it was not good either.
Comment 1 Gabor Kelemen (allotropia) 2022-03-17 17:20:07 UTC
Created attachment 178944 [details]
The example file in Word and Writer master
Comment 2 Dieter 2022-03-31 15:24:14 UTC
I confirm it with

Version: 7.3.2.2 (x64) / LibreOffice Community
Build ID: 49f2b1bff42cfccbd8f788c8dc32c1c309559be0
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: zh-CN (de_DE); UI: en-GB
Calc: CL
Comment 3 QA Administrators 2025-07-29 03:10:25 UTC Comment hidden (obsolete, spam)
Comment 4 Justin L 2025-08-19 20:10:28 UTC
Created attachment 202385 [details]
Subscription Agreement_minimized.docx: minimal reproducer

<w:p w14:paraId="571C18F7" >
  <w:pPr>
    <w:pStyle w:val="Schedule-1Title"/> # style contains a pageBreakBefore
    <w:pageBreakBefore w:val="0"/>      # turns off the style's page break
  </w:pPr>
  <w:r w:rsidRPr="007C0C28">
    <w:br w:type="column"/>             # column break
  </w:r>
  <w:r w:rsidRPr="007C0C28">
\    <w:br/>                            # line break
  </w:r>

So the column break gets added onto a line break (which is a numbered entry) via the CONTEXT_CHARACTER. Everything looks fine from a writerfilter aspect - UNO applies the column break to the paragraph property.

Then the end of the paragraph rolls around, and the paragraph direct formatting CONTEXT_PARAGRAPH "BreakType" applies its value BreakType::BreakType_NONE.

Solved by judiciously Inserting into the paragraph properties instead of the character properties. (Since there is no splitting of paragraphs in this code, it affects the entire paragraph and not only the "runs" that follow this w:br run.)
Comment 5 Commit Notification 2025-08-20 00:46:21 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/bc511e9b7f33ff2b5e2b5e16debc550af73c3ada

tdf#148057 writerfilter: overwrite BreakType::None

It will be available in 26.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.