Bug 135343 - Word treats section break as column break or page break depending on compatibilityMode
Summary: Word treats section break as column break or page break depending on compatib...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:7.1.0
Keywords:
Depends on:
Blocks: DOCX-compatibilityMode-15
  Show dependency treegraph
 
Reported: 2020-07-31 13:02 UTC by Justin L
Modified: 2020-08-11 19:33 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
n652364_c15.docx: hand modified to change compatibilityMode=15 (from 11) (11.14 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-07-31 13:02 UTC, Justin L
Details
columnSectionBreak_c15.docx: as much complexity as I could muster in two pages. (11.61 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-08-01 08:00 UTC, Justin L
Details
columnSectionBreak_c14.docx: Word 2010 version still fits on only one page. (11.61 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-08-01 08:06 UTC, Justin L
Details
columnSectionBreak_c14.pdf: how the one page looks in Word 2016 (4.12 KB, application/pdf)
2020-08-01 08:10 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2020-07-31 13:02:15 UTC
Created attachment 163811 [details]
n652364_c15.docx: hand modified to change compatibilityMode=15 (from 11)

attachment 163807 [details] (n652364_A6.docx) is the compat=11 version. It is a one-page document, and the section break is treated as a column break, so you get a document that looks like
TEXT1                    TEXT2
text1                    text2

The attached version is identical except that it changed the compatibilityMode setting to 15.  Now the break is treated like a section page break, looking like
TEXT1
text1

--- page break ---
TEXT2
text2


Unfortunately, LO 7.1 doesn't open it either way.  It looks like
TEXT1                    text1

--- page break ---
TEXT2
text2
Comment 1 Justin L 2020-07-31 18:58:50 UTC
It looks like LO NEVER exports a nextColumn section break (nBreakCode = 1). It just uses a normal column break. Hurray!

Fortunately, in Word it is not easy to make a column section break. In old Word 2003, it isn't a UI option under "insert breaks". It can only be specified in "page setup", "layout", "section start new column".

So, my guess is that LO has absolutely no clue how to handle a real section column break. (Indeed, no unit tests fail if that section of code is just commented out.)

What we probably need to do for the compat11 case is to EXTEND the existing section to cover this text (HOW?), and insert a regular column-break-before at the start of the range. (It looks like that is all the columnbreak code is trying to do, except that it fails to extend the previous section.

For the compat15 case, it looks like it should just treat a nextColumn as a nextPage. [Need to test the compat version though. What do 14 and 12 do?]
Comment 2 Justin L 2020-08-01 08:00:47 UTC
Created attachment 163841 [details]
columnSectionBreak_c15.docx: as much complexity as I could muster in two pages.

This is a two page document showing how badly LO currently handles column breaks. It was round-tripped by Word 2016 as compatibility mode = 11, and then hand-tweaked to be changed into compatibilityMode 15 - which caused the page break to happen at the section-column-break before the RTL column section.
Comment 3 Justin L 2020-08-01 08:06:34 UTC
Created attachment 163842 [details]
columnSectionBreak_c14.docx: Word 2010 version still fits on only one page.

(In reply to Justin L from comment #1)
> [Need to test the compat version though. What do 14 and 12 do?]
Yes, like most things it behaves very differently starting with compat 15.

> What we probably need to do for the compat14 case is to EXTEND the existing
> section to cover this text.
Yes, after more testing this still seems to be the case.
Comment 4 Justin L 2020-08-01 08:10:32 UTC
Created attachment 163843 [details]
columnSectionBreak_c14.pdf: how the one page looks in Word 2016
Comment 5 Justin L 2020-08-01 11:42:54 UTC
proposed fix at https://gerrit.libreoffice.org/c/core/+/99936

Still needed is a way to join the section to the previous via a column break.
Comment 6 Commit Notification 2020-08-07 08:12:39 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/75b45d43b53abd457c98f47078ca7ff3c492ce2c

tdf#135343 writerfilter: compat15 treats section nextCol as nextPage

It will be available in 7.1.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.
Comment 7 Commit Notification 2020-08-11 19:33:03 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/98665425ebb5cdeeda341336871ca4da7f4842b7

related tdf#135343 writerfilter: document broken nextColumn

It will be available in 7.1.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.