Bug 126105 - Exporting to docx changes page margins under certain conditions
Summary: Exporting to docx changes page margins under certain conditions
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.0.7.3 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-26 08:36 UTC by wiedenhoeft.umg
Modified: 2019-06-26 11:35 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Original ODT file (7.90 KB, application/vnd.oasis.opendocument.text)
2019-06-26 08:41 UTC, wiedenhoeft.umg
Details
Exported DOCX file (4.04 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-06-26 08:42 UTC, wiedenhoeft.umg
Details
Screenshot of attachment 152411 margins (68.80 KB, image/png)
2019-06-26 10:55 UTC, Mike Kaganski
Details
Screenshot of DOCX (118.02 KB, image/png)
2019-06-26 11:04 UTC, wiedenhoeft.umg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wiedenhoeft.umg 2019-06-26 08:36:48 UTC
Description:
Exporting to docx and reopening the exported file changes margins and other stuff.

Steps to Reproduce:
Create the following document:

* page size 10 by 10 cm
* all page margins 0.5 cm (get complaint that those are outside the print range)
* set border around the page, line width 0.05pt, with 0.5cm padding on all sides

Export to to docx via "Save a copy". Open the exported docx file with LO Writer.

Actual Results:
The docx file now looks like this:

* page size 10 by 10 cm
* all page margins 1.0 cm
* border has line width 0.25pt, with 0.49cm padding on all sides

Expected Results:
Margins etc. should be the same as in odt file.


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 wiedenhoeft.umg 2019-06-26 08:41:38 UTC
Created attachment 152410 [details]
Original ODT file
Comment 2 wiedenhoeft.umg 2019-06-26 08:42:10 UTC
Created attachment 152411 [details]
Exported DOCX file
Comment 3 Mike Kaganski 2019-06-26 09:21:14 UTC
This is not a bug, but a natural result of DOCX limitations. See bug 112118 comment 13 for some details; what's relevant here is that ECMA-376-1:2016 ch. 17.6.7 (for w:left; also relevant chapters for other borders) specifies that sz (border width) for lines is measured in 1/8 of a point, and the minimum value for sz is 2, which means that 2/8 = 1/4 of a pt = 0.25 pt is the minimum width of the line in DOCX.

Now take into account that in LibreOffice (and in ODF format), the border width is *added* to margins to offset the page body: try setting page borders to e.g. 9 pt, and look closely at the position of text when confirming the change. So, in order to *keep the page body* as in the original, LibreOffice has to decrease margins a little, otherwise page body would shrink.

So - no bug here; having different document models, some things simply have no 1:1 mapping between formats. Use native format to have best fidelity; nothing can be improved in this case.
Comment 4 wiedenhoeft.umg 2019-06-26 09:27:24 UTC
Does this explain why page margins double from 0.5 to 1cm?
Comment 5 Mike Kaganski 2019-06-26 09:30:41 UTC
(In reply to Mike Kaganski from comment #3)
> ... So, in order to *keep the page body* as in the original, LibreOffice
> has to decrease margins a little, otherwise page body would shrink.

I meant "LibreOffice has to decrease padding a little", not margins. By the way, in comment 0, there is an error: in "Actual Results", all margins said to be 1.0 cm, while actually they are 0.5 cm, just as in original document; only border line widths and paddings change.
Comment 6 Mike Kaganski 2019-06-26 09:33:44 UTC
(In reply to wiedenhoeft.umg from comment #4)
> Does this explain why page margins double from 0.5 to 1cm?

They don't. Possibly you see page in different zoom; but the margin sizes are still 0.5.

Please don't set it to a wrong resolution. This report has no fix, it's just not a bug. FIXED is only for bugs with a known commit making it to work as original poster wants.
Comment 7 wiedenhoeft.umg 2019-06-26 10:44:34 UTC
Yes, they do. I attached the files. Would you like me to attach a screenshot of the page style dialog as well which shows that the page margins are 1cm?
Comment 8 Mike Kaganski 2019-06-26 10:55:42 UTC
Created attachment 152413 [details]
Screenshot of attachment 152411 [details] margins

Taken with Version: 6.2.5.1 (x64)
Build ID: 9a940173fab1747f02322bc89779759d52b3a086
CPU threads: 4; OS: Windows 10.0; UI render: GL; VCL: win; 
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: threaded
Comment 9 wiedenhoeft.umg 2019-06-26 11:04:29 UTC
Created attachment 152414 [details]
Screenshot of DOCX

Screenshot of the page style dialog showing 1cm margins of the downloaded docx file (attachment 152411 [details])
Comment 10 Mike Kaganski 2019-06-26 11:11:38 UTC
Ah! The bug is filed against 6.0.7.3! That not starts to make sense, since 6.0 is EOLed long ago, and 6.1 is just about to EOL, too. It never makes sense to file bugs without testing with newer supported versions first.

In this case, the 0.5 cm margin increase part is duplicate of the mentioned bug 112118. Still I close it again as NOTABUG, making it different from that bug to emphasize the expected changes in line width and padding.
Comment 11 wiedenhoeft.umg 2019-06-26 11:13:54 UTC
Wow, so Ubuntu 18.04 users are stuck with EOL'ed software, i guess :-/
Comment 12 Mike Kaganski 2019-06-26 11:26:34 UTC
(In reply to wiedenhoeft.umg from comment #11)
> Wow, so Ubuntu 18.04 users are stuck with EOL'ed software, i guess :-/

There are multiple ways to upgrade for Ubuntu users:

1. PPAs from Ubuntu's LibreOffice Packaging team (those people who maintain the official package): [1] for fresh, [2] for 6.2, [3] for 6.1, ...
2. Platpak [4]
3. Snap [5]
4. AppImage [6]
5. DEB package from TDF [7]

I don't think that looks like "stuck".

[1] https://launchpad.net/~libreoffice/+archive/ubuntu/ppa
[2] https://launchpad.net/~libreoffice/+archive/ubuntu/libreoffice-6-2
[3] https://launchpad.net/~libreoffice/+archive/ubuntu/libreoffice-6-1
[4] https://www.libreoffice.org/download/flatpak/
[5] https://www.libreoffice.org/download/snap/
[6] https://www.libreoffice.org/download/appimage/
[7] https://www.libreoffice.org/download/download/?type=deb-x86_64
Comment 13 wiedenhoeft.umg 2019-06-26 11:30:30 UTC
Thanks.

"Most of the packages in this PPA have only experienced minor testing -- in fact it is the place to enable a wider audience to test packages before they are published into the distro proper. In general, this PPA is _not_ for the average user to install without a closer look (if it would be, its packages would be in the main repositories). OTOH, it is _way_ _better_ to use packages from this PPA than using the *.deb files that The Document Foundation provides upstream"

But anyway, I guess that's Ubuntu's problem, not LO's. I consider this matter closed. Thanks for your time! :)
Comment 14 Mike Kaganski 2019-06-26 11:31:23 UTC
OP: PLEASE don't change resolution here. There is specific meaning for each field here. If you insist that the main problem here is doubling the margin, then the correct resolution is DUPLICATE. If we take the notion that this is about border width and padding, then this is NOTABUG (and I prefer this resolution, because it helps *other users* when they would want to file similar bugs, allowing to point here). But in no case should this be FIXED. Let us not do useless noise changing the technical information here, which is here for developers, not for users. Thanks.
Comment 15 wiedenhoeft.umg 2019-06-26 11:35:48 UTC
I don't think I've touched anything that would change resolution so far... I'm gonna set this to CLOSED NOTABUG now.