Bug 140342 - FILEOPEN DOCX border with position from text is wrong, if gutter present
Summary: FILEOPEN DOCX border with position from text is wrong, if gutter present
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Hardware: x86-64 (AMD64) All
: medium enhancement
Assignee: Miklos Vajna
Whiteboard: target:7.2.0
Depends on:
Blocks: Gutter-Margins
  Show dependency treegraph
Reported: 2021-02-11 15:12 UTC by Regina Henschel
Modified: 2021-03-05 15:40 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

DOCX to reproduce the error (16.66 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2021-02-11 15:12 UTC, Regina Henschel
Border together with Gutter, Screenshot left Word, right LibreOffice (193.67 KB, image/png)
2021-02-11 15:19 UTC, Regina Henschel
the same with a new odt with gutter different than zero (22.35 KB, application/vnd.oasis.opendocument.text)
2021-02-22 07:21 UTC, BogdanB

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2021-02-11 15:12:06 UTC
Created attachment 169675 [details]
DOCX to reproduce the error

If the document has a gutter specified and the page border is given relative to text edge, then the border is wrongly drawn.
The border is correct, if gutter is set to 0 in Word.
Comment 1 Regina Henschel 2021-02-11 15:19:31 UTC
Created attachment 169678 [details]
Border together with Gutter, Screenshot left Word, right LibreOffice
Comment 2 BogdanB 2021-02-22 07:18:32 UTC
Confirm with
Version: / LibreOffice Community
Build ID: 7b649f835cc00ed76927c6821a135605609bed4e
CPU threads: 4; OS: Linux 5.8; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 3 BogdanB 2021-02-22 07:21:34 UTC
Created attachment 169958 [details]
the same with a new odt with gutter different than zero
Comment 4 Miklos Vajna 2021-02-26 10:32:44 UTC
Regina: thanks for this sample, very useful one. So Word has 2 modes for border description, the distance can be measured "form text" or "from page". I was aware of this, but I was not aware that my simple sw/qa/extras/ooxmlexport/data/gutter-top.docx sample accidentally used the "from page" mode. The reason your sample is broken is because it uses "from text".

So it points out an important problem: similar to how normal borders are handled (when there is no gutter), the "from page" part of the gutter handling should happen at DOCX import/export time and Writer layout should continue to measure borders "from text". I'll look into this.
Comment 5 Commit Notification 2021-03-01 19:56:42 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":


tdf#140342 sw layout: remove explicit gutter handling when positioning borders

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

Affected users are encouraged to test the fix and report feedback.
Comment 6 Miklos Vajna 2021-03-02 08:52:03 UTC
No backport, gutter margin is master-only.
Comment 7 Regina Henschel 2021-03-05 15:40:53 UTC
Import is OK now in Version: (x64) / LibreOffice Community
Build ID: 8e49505fa7352023c252bf794ae84c9082d7264e
CPU threads: 8; OS: Windows 10.0 Build 19041; UI render: Skia/Raster; VCL: win
Locale: de-DE (en_US); UI: en-US
Calc: CL