Bug 162148 - FILEOPEN DOC Wrong inner margin in mirrored page, starting on Even side
Summary: FILEOPEN DOC Wrong inner margin in mirrored page, starting on Even side
Status: RESOLVED DUPLICATE of bug 133445
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:doc
Depends on:
Blocks: DOC-Page Writer-Styles-Page-Odd-Even
  Show dependency treegraph
 
Reported: 2024-07-22 17:15 UTC by Gabor Kelemen (allotropia)
Modified: 2025-01-20 19:33 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
printscreen from Word (24.49 KB, image/png)
2024-08-18 05:37 UTC, raal
Details
Page number format5.docx: made with Word 2010 - starts on page 5 (5cm left margin) (15.87 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-01-20 18:53 UTC, Justin L
Details
Page number format6.docx: same document starting with page 6 (0cm left margin) (15.88 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-01-20 18:53 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2024-07-22 17:15:54 UTC
This is split from bug 161521 for the doc case:

attachment 194671 [details] represents a special case of page margin settings: it is mirrored, with the outside margin being 4.27 cm, and starting on an even page.

This is imported incorrectly in Writer: while in Word the 4.7 cm margin is on the left side of the first page, in Writer is on the right side, changing page layout.

1. Open attached document
-> "Hello" and "Footer" text is at the very left edge of the page, instead of being 4.7 cm from it.
In Print view there is an automatically inserted blank page in front of the page.

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 1755ac5255ffcb6f6fb3a2fb61be649666c4a788
CPU threads: 14; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: threaded
Comment 1 raal 2024-08-18 05:37:07 UTC
I can confirm with Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: ccdf1096a6103d2ab8690e8e97dcf3496160ecff
CPU threads: 4; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded
Comment 2 raal 2024-08-18 05:37:26 UTC
Created attachment 195885 [details]
printscreen from Word
Comment 3 Justin L 2025-01-20 18:53:00 UTC
Created attachment 198639 [details]
Page number format5.docx: made with Word 2010 - starts on page 5 (5cm left margin)

So, IIUC the DOCX version ONLY works because we (currently) force it to use alternating LEFT-only and RIGHT-only LO-specific page styles - which is a huge emulation hack. (And because the document starts with LEFT-only even page, a blank odd page 1 is seen in book view) 

On the DOC import side, we don't do any of those things. And I don't think we want to try to go in that direction - since LO can also support "different Left/Right header content". So DOC import has properly imported "mirrored margins" and the proper "inner" and "outer" margins.

Rather, the key here seems to be with even/odd view in book layout mode. Since our document starts on page 2, LO OUGHT to be forcing a blank page 1 (in book view) and thus treat the first page 2 as an EVEN page (which would then receive the mirrored margins). [But I imagine that would reek havoc for ODT documents.]

If my analysis is correct, this is just a fundamental difference between Word and LO layout. LO doesn't REALLY worry about making sure that even page numbers are always on the LEFT side, or that odd page numbers are always on the RIGHT side. However, it appears that MS Word does.
Comment 4 Justin L 2025-01-20 18:53:51 UTC
Created attachment 198640 [details]
Page number format6.docx: same document starting with page 6 (0cm left margin)
Comment 5 Justin L 2025-01-20 19:33:26 UTC
Up until LO 7.0, if a document started on an "even" page number, book view inserted a blank page before it. So my examples documents looked OK before
commit 509a02aa96f6d7620cb0bf06c20b3bfa0641be92
Author: Michael Stahl on Tue Feb 18 19:18:47 2020 +0100
    tdf#125682 sw: don't insert empty page before first page with even number

    TODO: A useful improvement would be to detect in Word import filters that
    the first page is even numbered and then invert the mapping of all of the
    page styles, i.e. odd header/footer->left instead of right, and if
    mirrorMargins, pgMar left -> inner instead of outer.

So this probably should be marked as a duplicate of fallout bug 133445.

Yeah, don't want to muck around here. It would open up a whole boat load of hurt.

*** This bug has been marked as a duplicate of bug 133445 ***