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.
Created attachment 169678 [details]
Border together with Gutter, Screenshot left Word, right LibreOffice
Version: 18.104.22.168.alpha0+ / 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
Created attachment 169958 [details]
the same with a new odt with gutter different than zero
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.
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.
No backport, gutter margin is master-only.
Import is OK now in Version: 22.214.171.124.alpha0+ (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