Bug Hunting Session
Bug 94009 - FILESAVE: DOCX - Margins not preserve
Summary: FILESAVE: DOCX - Margins not preserve
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: Other All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:6.2.0
Keywords: filter:docx, notBibisectable, regression
Depends on:
Blocks: DOCX-Tables
  Show dependency treegraph
 
Reported: 2015-09-08 07:07 UTC by Yousuf Philips (jay) (retired)
Modified: 2018-09-17 04:57 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
bug confirmed, screenshot (188.56 KB, image/jpeg)
2015-09-08 08:48 UTC, steve -_-
Details
0pgMar.odt: minimal reproducer test when saving to .doc or .docx (11.72 KB, application/vnd.oasis.opendocument.text)
2018-09-03 18:42 UTC, Justin L
Details
How it looks on 6.2 (384.25 KB, image/png)
2018-09-15 15:45 UTC, BogdanB
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuf Philips (jay) (retired) 2015-09-08 07:07:00 UTC
Steps:
1) Open GB_2013.docx in attachment 105410 [details]
2) Notice that the page margins are 0.00 on all sides
3) Save As a new file
4) Open up the new file
5) Notice the page top and bottom margins are 1.00

Regression as this worked correctly in 4.1.6. The saved document also doesnt open in Word 2010 and gives the error 'Invalid parameter. Location: Part: /word/document.xml, Line: 2, Column: 0'.

Version: 5.1.0.0.alpha1+
Build ID: cf9fbdb379e2935677a73ced513d7faf855c299c
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2015-09-05_00:34:47
Locale: en-US (en_US.UTF-8)
Comment 1 steve -_- 2015-09-08 08:48:04 UTC
Resaved as new docx file. Problem confirmed on

OSX 10.10.5
LO Version: 5.1.0.0.alpha1+
Build ID: 50f2c712c46c66264279ab3b61888e491a4d8dca
TinderBox: MacOSX-x86_64@49-TDF, Branch:master, Time: 2015-09-04_04:59:19
Locale: de-DE (de.UTF-8)

Attaching screenshot.
Comment 2 steve -_- 2015-09-08 08:48:46 UTC
Created attachment 118515 [details]
bug confirmed, screenshot
Comment 3 Robinson Tryon (qubit) 2015-12-14 05:32:51 UTC Comment hidden (obsolete)
Comment 4 Joel Madero 2015-12-20 06:21:38 UTC
Unfortunately this bug isn't bibisectable because of a separate bug that happens in the bibisect that prevents saving the file at all (infinite loop during save as). Marking as such.
Comment 5 Commit Notification 2016-02-18 13:26:39 UTC Comment hidden (obsolete)
Comment 6 Commit Notification 2016-02-18 15:59:12 UTC Comment hidden (obsolete)
Comment 7 Commit Notification 2016-02-18 16:01:39 UTC Comment hidden (obsolete)
Comment 8 Commit Notification 2016-02-19 12:19:24 UTC Comment hidden (obsolete)
Comment 9 Adolfo Jayme 2016-02-22 09:33:02 UTC Comment hidden (obsolete)
Comment 10 Michael Stahl (CIB) 2016-02-22 11:32:10 UTC Comment hidden (obsolete)
Comment 11 Justin L 2018-08-23 19:18:04 UTC
This makes heavy use of continuous section breaks which are deadly for compatibility and page styles. (Page 2 starts with section 6.)
Comment 12 Justin L 2018-09-03 18:42:04 UTC
Created attachment 144642 [details]
0pgMar.odt: minimal reproducer test when saving to .doc or .docx

I think the problem is in SW code handling sections, because writerfilter passes the top margin property all the way to unostyles.cxx. Likely, because everything is a default value, the property isn't being SET, and so is never exported.

The problem is avoidable by forcing a non-default value in PropertyMap.cxx
-Insert( PROP_TOP_MARGIN, uno::makeAny( std::max<sal_Int32>(nTopMargin, 0) ) );
+Insert( PROP_TOP_MARGIN, uno::makeAny( std::max<sal_Int32>(nTopMargin, 1) ) );
Comment 13 Justin L 2018-09-04 07:35:43 UTC
OK. Not at all related to SW internals. Simply export code ignoring defaults.  gerrit.libreoffice.org/59967 tdf#94009 ww8export: always export section margins
Comment 14 Commit Notification 2018-09-04 19:30:59 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=efd316b6171b9e1827c5e34ddb12658f48268e24

tdf#94009 ww8export: always export section margins

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 BogdanB 2018-09-15 15:45:09 UTC
Created attachment 144900 [details]
How it looks on 6.2

This is how it looks on 6.2 after save as...
As speaking about margins this are zero, it's perfect. But the document aspect changed.

Version: 6.2.0.0.alpha0+
Build ID: 9a9b81c7212fa6a6762246593acf3f1950677a22
CPU threads: 4; OS: Linux 4.15; UI render: GL; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2018-09-08_00:00:43
Locale: ro-RO (ro_RO.UTF-8); Calc: threaded