Download it now!
Bug 119952 - FILEOPEN Negative margins coming from Word are not handled
Summary: FILEOPEN Negative margins coming from Word are not handled
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:docx
: 118489 (view as bug list)
Depends on:
Blocks: DOCX-Page
  Show dependency treegraph
 
Reported: 2018-09-18 09:03 UTC by Aron Budea
Modified: 2019-09-17 14:24 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Sample DOCX (13.84 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-09-18 09:03 UTC, Aron Budea
Details
Screenshot in Word (29.51 KB, image/png)
2018-09-18 09:05 UTC, Aron Budea
Details
Sample DOCX compared MSO LO (117.09 KB, image/png)
2019-09-17 14:24 UTC, Timur
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2018-09-18 09:03:09 UTC
Created attachment 144973 [details]
Sample DOCX

The attached DOCX has top and bottom margin set to -2" and -1.5" respectively, with some header/footer text. As far as I can see Word treats this as the non-negative value.

In Writer the header/footer aren't shown. After saving, the margins are set to unexpected values, though at least the header/footer text becomes visible.

Observed using LO 6.1.1.2 & 3.3.0 / Windows 7.
In 5.2.0.4 the header/footer are still visible on open (not in 5.3.0.3), though the margins are still incorrect. This change could be bibisected.
Comment 1 Aron Budea 2018-09-18 09:05:55 UTC
Created attachment 144974 [details]
Screenshot in Word
Comment 2 Mike Kaganski 2018-09-18 09:59:04 UTC
Relevant spec:

ECMA-376-1:2016 17.6.11 pgMar (Page Margins)

> A negative value indicates that the contents of the main document shall be measured
> from the bottom of the page extent regardless of the footer for that document, and
> therefore shall overlap the footer text.

A code pointer: SectionPropertyMap::PrepareHeaderFooterProperties (writerfilter/source/dmapper/PropertyMap.cxx)
Comment 3 Mike Kaganski 2018-09-18 10:45:42 UTC
Ww8 implementation for reference: wwSectionManager::SetPageULSpaceItems in sw/source/filter/ww8/ww8par6.cxx
Comment 4 Aron Budea 2018-09-18 16:35:10 UTC
(In reply to Aron Budea from comment #0)
> In 5.2.0.4 the header/footer are still visible on open (not in 5.3.0.3),
> though the margins are still incorrect. This change could be bibisected.
Here's the result with bibisect-linux-64-5.3. Seems unrelated, but apparently an exception is triggered somewhere.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=bdd4a238a1d8a0cbbebbd759011050659668f92b
author		Justin Luth <justin_luth@sil.org>	2016-09-09 12:42:55 +0300
committer	Justin Luth <justin_luth@sil.org>	2016-09-09 12:54:23 +0000

tdf#86926 writerfilter allow fallback if exceptions
Comment 5 Mike Kaganski 2018-09-18 21:36:52 UTC
I believe that there's no need in the bisecting, because there's a need to reimplement the function, and that fixes all this at once. The "regression" part is simply some coincidence.

I created a quick attempt: https://gerrit.libreoffice.org/60730. It is not complete, and I don't plan to continue it ATM. Feel free to continue based on it. Its problems are mentioned in the commit message.
Comment 6 Timur 2019-09-17 14:24:18 UTC
Created attachment 154232 [details]
Sample DOCX compared MSO LO
Comment 7 Timur 2019-09-17 14:24:34 UTC
*** Bug 118489 has been marked as a duplicate of this bug. ***