Bug 120145

Summary: FILEOPEN Multiple sections with different margins change 2-column layout to 4 in DOC
Product: LibreOffice Reporter: Aron Budea <aron.budea>
Component: CalcAssignee: Justin L <jluth>
Status: RESOLVED FIXED    
Severity: normal CC: ilmari.lauhakangas, jluth, xiscofauli
Priority: medium Keywords: filter:doc
Version: 4.4.0.3 release   
Hardware: All   
OS: All   
Whiteboard: target:6.3.0 target:6.2.1
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 107836, 112762    
Attachments: Sample DOC
PDF exported in Word
Sample DOC
PDF exported in Word
Sample DOCX

Description Aron Budea 2018-09-27 03:50:14 UTC
Created attachment 145199 [details]
Sample DOC

The attached DOC was created in Word, and contains a continuous section break. The second section has 2-column layout, and slightly different margins than the first.

In Writer the new section starts on a new page, and becomes a 4-column layout. If the margins are the same, no such issue occurs. No issue with the same file in DOCX format, either.

Observed using LO 6.2 daily build (2018-09-22, 8b1501d80dc9d3f42c351c6e026fa737e116cae5), 4.4.0.3 / Windows 7.
Document looks fine in LO 4.0.0.3.
=> regression
Comment 1 Aron Budea 2018-09-27 03:51:21 UTC
Created attachment 145200 [details]
PDF exported in Word
Comment 2 Aron Budea 2018-09-27 04:07:05 UTC
Bibisected to the following commit using repo bibisect-44max. Might be difficult to fix.

author		Luboš Luňák <l.lunak@collabora.com>	2014-07-21 10:56:52 +0200
committer	Luboš Luňák <l.lunak@collabora.com>	2014-07-21 11:02:04 +0200

ww8import create a pagedesc if continuous section changes margins (bnc#875383)

This is similar to what writerfilter does. MSWord can have one page with several different margins, which are saved using continuous sections, which causes all kinds of trouble, because either we treat them as Writer sections, which means we lose some of the data, or we treat them as Writer page styles, which causes spurious page breaks if in the wrong place. Either option has its problems, but here it seems slightly better to go for keeping the data and hoping the page break will be in a place where a break will be anyway.
Comment 4 Aron Budea 2018-09-27 11:00:42 UTC
Created attachment 145208 [details]
Sample DOC

I updated the sample so it's longer than one page by default, and there's a larger difference between the margins of the two sections.
Comment 5 Aron Budea 2018-09-27 11:01:28 UTC
Created attachment 145209 [details]
PDF exported in Word
Comment 6 Aron Budea 2018-09-27 11:05:59 UTC
Created attachment 145210 [details]
Sample DOCX

For reference, here's the DOCX file with the same content, now it's obvious that the margin change is lost in this case.

Perhaps the DOC importer has the better workaround, and the DOCX importer should be adjusted, but the 2-column layout becoming 4-column seems to be a bug. However, that's not because of this commit, as far as I can see.
Comment 7 Buovjaga 2018-10-23 17:50:35 UTC
Confirmed.

Arch Linux 64-bit
Version: 6.2.0.0.alpha0+
Build ID: 9a373521d7a328197a4bf9abeb0a981b7acba896
CPU threads: 8; OS: Linux 4.18; UI render: default; VCL: gtk3_kde5; 
Locale: fi-FI (fi_FI.UTF-8); Calc: threaded
Built on 19 October 2018
Comment 8 Justin L 2019-01-11 10:04:21 UTC
proposed fix at https://gerrit.libreoffice.org/66151
Comment 9 Commit Notification 2019-01-12 16:11:49 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/84fefd7c295fc05499ca222dff50c2fe4e0fb27e%5E%21

tdf#120145 ww8import: ignoreCols if section is inserted

It will be available in 6.3.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 10 Buovjaga 2019-01-13 14:07:22 UTC
Confirmed the fix with attachment 145208 [details].

Áron: is there a report for the issue of the section starting on a new page?

Arch Linux 64-bit
Version: 6.3.0.0.alpha0+
Build ID: 6e3c4ae8bca898700cde9caaff43c3a8a61eebc2
CPU threads: 8; OS: Linux 4.20; UI render: default; VCL: gtk3; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 13 January 2019
Comment 11 Aron Budea 2019-01-13 22:17:21 UTC
(In reply to Buovjaga from comment #10)
> Áron: is there a report for the issue of the section starting on a new page?
Word's continuous section break is an alien concept in LO, it can change several document properties mid-page that LO can only do with a new page style (headers/footers, margin etc.). I guess bug 89297 could be considered as the general enhancement of providing a similar functinality.

Justin, thanks for fixing the bug with the columns.
Comment 12 Commit Notification 2019-01-31 09:25:56 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-6-2":

https://git.libreoffice.org/core/+/0e863f5529318e07f46568150e489cb0bef9b616%5E%21

tdf#120145 ww8import: ignoreCols if section is inserted

It will be available in 6.2.1.

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.