Bug Hunting Session
Bug 106572 - FILEOPEN DOCX: header position becomes page margin
Summary: FILEOPEN DOCX: header position becomes page margin
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
5.3.0.3 release
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: interoperability target:6.2.0
Keywords: filter:docx
: 106635 (view as bug list)
Depends on:
Blocks: DOCX-Header-Footer
  Show dependency treegraph
 
Reported: 2017-03-16 13:31 UTC by Gabor Kelemen
Modified: 2018-08-16 07:40 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
The problematic document with header position set (258.55 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2017-03-16 13:31 UTC, Gabor Kelemen
Details
The document in LO 5.3 and Word 2010 side by side (382.15 KB, image/png)
2017-03-16 13:32 UTC, Gabor Kelemen
Details
Screenshot in current 6.2 master and Word 2010 (351.24 KB, image/png)
2018-06-26 17:44 UTC, Gabor Kelemen
Details
Header settings when opened in current master build (43.00 KB, image/png)
2018-06-26 19:33 UTC, Gabor Kelemen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen 2017-03-16 13:31:26 UTC
Created attachment 131931 [details]
The problematic document with header position set

Attached document has a header position set as 3 cm from top, but in LO 5.3 this setting becomes the page margin from top, creating a lot larger empty space than in Word 2013.
Comment 1 Gabor Kelemen 2017-03-16 13:32:23 UTC
Created attachment 131932 [details]
The document in LO 5.3 and Word 2010 side by side
Comment 2 Aron Budea 2017-03-16 19:28:13 UTC Comment hidden (obsolete)
Comment 3 Aron Budea 2017-03-16 19:30:24 UTC Comment hidden (obsolete)
Comment 4 V Stuart Foote 2017-03-16 23:10:01 UTC
Can not reproduce.

On Windows 10 Pro 64-bit en-US with
Version: 5.3.1.2 (x64)
Build ID: e80a0e0fd1875e1696614d24c32df0f95f03deb2
CPU Threads: 8; OS Version: Windows 6.19; UI Render: GL; Layout Engine: new; 
Locale: en-US (en_US); Calc: group

The Header layout/spacing is the same LO 5.3.1 and MS Word 2007
Comment 5 Aron Budea 2017-03-18 00:36:33 UTC
I can see that there's a much larger gap above the header (also below the header) in LO 5.3.0.3 than in Word 2013, just like in the screenshots.

Note that in Word there are different settings for the first page, the 3 cm / 1.5 cm header/footer seem to be coming directly from there.
Comment 6 Xisco Faulí 2017-03-19 11:24:26 UTC
*** Bug 106635 has been marked as a duplicate of this bug. ***
Comment 7 Ari Latvala 2017-05-25 20:49:33 UTC
Problem still exist on Writer 5.3.3.2 on 64-bit Windows 10 Creators Update.
Comment 8 QA Administrators 2018-06-26 02:43:57 UTC Comment hidden (obsolete)
Comment 9 Gabor Kelemen 2018-06-26 17:44:20 UTC
Created attachment 143144 [details]
Screenshot in current 6.2 master and Word 2010

While the EMF header looks much better, the top/bottom margin values are still overwritten by header/footer sizes.
Comment 10 Gabor Kelemen 2018-06-26 19:33:08 UTC
Created attachment 143148 [details]
Header settings when opened in current master build

What's maybe not obvious from the screenshot: the original document has "First page different" checked and "Even and odd different" not checked.

Opening the file in LO, both "Same content on left and right pages" and "Same content on first page" are checked.
Comment 11 Justin L 2018-08-14 04:31:34 UTC
Several problems here. The first problem to deal with is that the first page is not receiving the "First Page" pagestyle. That is related to the super tiny floating table as the first item in the document. Removing that table results in the first page style showing up. see commit 2e8aad6d45c53d554ccaf26de998ede708cfc289 Author: Vinaya Mandke CommitDate: Thu Apr 24 12:57:51 2014 +0200    
        fdo#39056 fdo#75431 Section Properties if section starts with table

(Emulation is creating first/follow pages styles instead of different firstpage header in the same style. That is normal, and necessary because the way Word and LO handle sections is completely different. So no worries about comment 10.

And that leads to the First/Follow page being totally different. This is something LO simply cannot do, and gets pretty confusing.  In Word, what you see on page 1 is the first-page header for section 1. Because of continuous section breaks the follow-page header is never seen, and neither is the first-page header for section 2.  Page 2 displays the follow-page header of section 2. (LO has nothing comparable to continuous sections. Since there is no page break, LO has no way of knowing when to switch to the next page style[Converted2].) This is a CANTFIX.

Dynamic height is also at play in the header size, but that seems to be legitimate.
Comment 12 Justin L 2018-08-15 04:14:32 UTC
(In reply to Justin L from comment #11)
> The first problem to deal with is that the first page
> is not receiving the "First Page" pagestyle.
proposed fix: https://gerrit.libreoffice.org/59033ñU

Existing ooxmlexport tests that also start with a table (and have the dummy paragraph) sometimes show the same problem, and sometimes don't. The "fix" doesn't break any of them though, so not sure why some worked anyway - my guess is that they didn't have a blank paragraph in the first cell.

Already OK: 1_page.docx, n780853.docx, table-row-data-displayed-twice.docx,  test_segfault_while_save.docx

Fixed: n779642.docx, floating-tables-anchor.docx
Comment 13 Commit Notification 2018-08-16 04:41:10 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9202597373f745b7b83dde1396636e1e619e4e81

tdf#106572 writerfilter: don't write to dummy paragraph

It will be available in 6.2.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 14 Justin L 2018-08-16 04:51:50 UTC
(In reply to Justin L from comment #11)
> Several problems here.
Is it OK to close this bug report? I would rate the header problem as unfixable (unless someone wants to hire a senior programmer for a year to re-write writer internals with a continuous section enhancement) and there are many bug reports already with this as the root cause. The dynamic spacing issue could be somewhat unique, but it probably related to anchor issues which again exists in countless bug reports.
Anyway, I've already convinced myself with that paragraph, so I'll mark it as fixed.
Comment 15 Gabor Kelemen 2018-08-16 07:40:14 UTC
(In reply to Justin L from comment #14)
> (In reply to Justin L from comment #11)
> > Several problems here.
> Is it OK to close this bug report? I would rate the header problem as
> unfixable (unless someone wants to hire a senior programmer for a year to
> re-write writer internals with a continuous section enhancement) and there
> are many bug reports already with this as the root cause. The dynamic
> spacing issue could be somewhat unique, but it probably related to anchor
> issues which again exists in countless bug reports.
> Anyway, I've already convinced myself with that paragraph, so I'll mark it
> as fixed.

Thanks for the fix!

Also thanks for estimating the way to properly fix this, I'll show this my bosses :).