Bug 74367 - FILEOPEN: wrong import of page margins in specific DOCX (see Comment 13)
Summary: FILEOPEN: wrong import of page margins in specific DOCX (see Comment 13)
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: low normal
Assignee: Attila Szűcs
URL:
Whiteboard: target:7.2.0
Keywords: filter:docx
Depends on:
Blocks: DOCX-Page
  Show dependency treegraph
 
Reported: 2014-02-02 12:07 UTC by Andras Timar
Modified: 2021-03-08 16:26 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
zero margins (22.12 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2014-02-02 12:07 UTC, Andras Timar
Details
bug file in Word with page settings (28.46 KB, image/png)
2016-05-16 10:58 UTC, Cor Nouws
Details
content from bug file in new clean Word doc (21.11 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-05-16 10:58 UTC, Cor Nouws
Details
clean WOrd doc with same page settings (visible at least) as bug doc (12.37 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-05-16 10:59 UTC, Cor Nouws
Details
Docx example where margins ignored (9.49 KB, application/wps-office.docx)
2016-12-22 09:13 UTC, Christopher POTTER
Details
Zero margins DOCX compared in MSO, OO, LO and master (178.55 KB, image/jpeg)
2018-06-26 07:03 UTC, Timur
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andras Timar 2014-02-02 12:07:39 UTC
Created attachment 93214 [details]
zero margins

Page margins are set in DOCX but they are 0 when imported into LibreOffice.
Comment 1 Jorendc 2014-02-12 19:05:44 UTC
Reproducible, tested using Mac OSX 10.9 with LibreOffice Version: 4.3.0.0.alpha0+ Build ID: a315454f349469923490e4116806ee19263849b8

Kind regards,
Joren
Comment 2 Joel Madero 2015-05-02 15:42:41 UTC Comment hidden (obsolete)
Comment 3 Andras Timar 2015-05-02 15:58:41 UTC
The problem is still there. Testted with Version: 5.0.0.0.alpha1+
Build ID: 415c62dc3c3e66f837ec0c89c5bc2d65e17641a7
Locale: en-US (en_US.UTF-8)
Comment 4 Timur 2016-03-14 18:46:11 UTC Comment hidden (obsolete)
Comment 5 Cor Nouws 2016-05-16 10:56:19 UTC
(In reply to Timur from comment #4)
> Possible similar problem: attachment 123358 [details] from Bug 98480.

No that is a different problem.
The margin settings in the specific bug doc from this issue are simply ignored. And that is uncommon.

I'll attach some files:
 1 picture showing page settings in Word
 2 new file from Word with content from attachment 93214 [details] copied into it
 3 new blank file from Word with same default margins.

2 and 3 open just fine in LibreOffice.

Removing 98480 and 33304 form CC
Comment 6 Cor Nouws 2016-05-16 10:58:10 UTC
Created attachment 125081 [details]
bug file in Word with page settings
Comment 7 Cor Nouws 2016-05-16 10:58:49 UTC
Created attachment 125082 [details]
content from bug file in new clean Word doc
Comment 8 Cor Nouws 2016-05-16 10:59:35 UTC
Created attachment 125083 [details]
clean WOrd doc with same page settings (visible at least) as bug doc
Comment 9 Cor Nouws 2016-05-16 11:01:09 UTC
NB: I opened the bug doc in Word and did some tests
- cleared formatting first paragraphs
- deleted section separator on page 2
- deleted tables
Non of these cured the problem
Comment 10 Christopher POTTER 2016-12-22 09:13:22 UTC
Created attachment 129860 [details]
Docx example where margins ignored

this document shows that margins have been *ignored* (it is displayed correctly with Office and WPS)
Comment 11 Christopher POTTER 2016-12-22 09:45:48 UTC
it seems that the problem is only in the document.xml part
Comment 12 QA Administrators 2018-06-26 02:46:09 UTC Comment hidden (obsolete)
Comment 13 Timur 2018-06-26 07:03:46 UTC
Created attachment 143122 [details]
Zero margins DOCX compared in MSO, OO, LO and master

Zero margins DOCX is created as 2007 DOCX, but issue with margins remains also when saved in MSO as 2013 version. 
In current LO versions 5.4 and master 6.2+ file looks better that before, but margins in LO remain 0 while they exist in MSO.
Comment 14 Justin L 2018-06-26 14:50:50 UTC
(In reply to Timur from comment #13)
> In current LO versions 5.4 and master 6.2+ file looks better that before,
The improvement came in 5.3, when "padding without borders" was honoured in bug 41542.

The code that is swapping the Margin and Border padding is in BorderDistanceFromWord(), which references the URL https://wiki.openoffice.org/wiki/Writer/MSInteroperability/PageBorder.

I'm not sure I want to tread here... Handle with care.
Comment 15 Xisco Faulí 2019-12-06 12:45:45 UTC
This issue seems to be solved in

Version: 6.5.0.0.alpha0+
Build ID: b5a4570e214f0e965a8b32cee3c615856ae07ac4
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

@Timur, @Andras, @Justin, @Cor, could you please recheck ?
Comment 16 Timur 2019-12-06 17:54:15 UTC
In 6.5+ attachment 93214 [details] opens as in 5.4 per attachment 143122 [details].
Looks similar to MSO, but page margin is 0 in LO and 2,5 cm in MSO.
Comment 17 Commit Notification 2021-02-15 10:33:47 UTC
Attila Szűcs committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b35f48d806f9e5ec689eda3828f1e4503644873b

tdf#74367 DOCX: fix page margins imported as border padding

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:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 18 Vincent Lefevre 2021-02-15 20:34:12 UTC
I've built 376101c41cf23852b19db5725b0257069f3abd2e (which includes the fix mentioned in comment 17) under Linux and tested it on the testcase from bug 98480 (which references this bug, see bug 98480 comment 6), and I still have the same issue, though I don't know whether the cause is wrong margins (but this would be an explanation).

For instance, the "......" after "PRENOM :" has been moved to the next line. In Format → Paragraph, tab "Indents & Spacings", if I reduce the "Indent After text" value, this fixes the issue. Alternatively, in Format → Page, tab "Page", if I reduce the right margin, this also fixes the issue, and also the issue that the frame below was not large enough. So the margins seem to be still wrong after opening the document.

Note: I am not a LibreOffice regular user. I use it only when I need to read (and edit) some files I've been sent.
Comment 19 NISZ LibreOffice Team 2021-03-08 14:52:56 UTC
(In reply to Vincent Lefevre from comment #18)
> I've built 376101c41cf23852b19db5725b0257069f3abd2e (which includes the fix
> mentioned in comment 17) under Linux and tested it on the testcase from bug
> 98480 (which references this bug, see bug 98480 comment 6), and I still have
> the same issue, though I don't know whether the cause is wrong margins (but
> this would be an explanation).

Hi Vincent

That document falls apart for a different reason, as stated in https://bugs.documentfoundation.org/show_bug.cgi?id=98480#c10

The red title of the document is followed by a continous section break and the new section has smaller right margin (0.05 cm) than the whole page (0.62 cm).

This setting is not imported to Writer at all, see bug #124637 about it.

In this bug the value display of the page margins and page borders padding was fixed - a visually similar but technically different problem, stemming from document model differences.
Comment 20 NISZ LibreOffice Team 2021-03-08 14:54:39 UTC Comment hidden (obsolete)
Comment 21 NISZ LibreOffice Team 2021-03-08 16:26:18 UTC
Verified in:

Version: 7.2.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 72841008bf422dfd8553240b3a78f0474d03523c
CPU threads: 4; OS: Windows 10.0 Build 17134; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: threaded Jumbo