Bug 100072

Summary: FILEOPEN DOCX Horizontal lines misplaced
Product: LibreOffice Reporter: Oliver Sander <oliver.sander>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: VERIFIED FIXED    
Severity: normal CC: ilmari.lauhakangas, patrick.jaap, vasily.melenchuk
Priority: medium Keywords: filter:docx
Version: 5.1.3.2 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=100074
Whiteboard: target:5.4.0 target:5.4.0.1 target:5.3.4
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 104520    
Attachments: The docx file in question
The document as shown by MSOffice 2010
The document as shown by LibreOffice 5.1.3
The document as rendered by LO-5.4alpha1

Description Oliver Sander 2016-05-26 19:49:16 UTC
Created attachment 125302 [details]
The docx file in question

I have a letter template from my university administration in docx format, which looks slightly different in MSOffice 2010 and LibreOffice 5.1.3.  In particular, the header contains two black lines spanning the entire page width.  However, LibreOffice only shows the left half.

Example documents are attached.  The document actually shows four different problems; I will open separate bugs for the other three.

Thanks for your consideration.
Comment 1 Oliver Sander 2016-05-26 19:50:05 UTC
Created attachment 125303 [details]
The document as shown by MSOffice 2010
Comment 2 Oliver Sander 2016-05-26 19:50:36 UTC
Created attachment 125304 [details]
The document as shown by LibreOffice 5.1.3
Comment 3 Buovjaga 2016-05-27 15:02:34 UTC
Confirmed.
Lines have slipped to the left, they are not too short.

Arch Linux 64-bit, KDE Plasma 5
Version: 5.3.0.0.alpha0+
Build ID: 60041cb237ea73c2c1885dd6afd99d88780c2dfc
CPU Threads: 8; OS Version: Linux 4.5; UI Render: default; 
Locale: fi-FI (fi_FI.UTF-8)
Built on May 26th 2016
Comment 4 Oliver Sander 2016-10-21 16:29:11 UTC
Reproduced with

LibreOfficeDev 5.3.0.0.alpha1 f4ca1573fcf445164c068c1046ab5d084e1b005f

Debian Testing, Mate Desktop
Comment 5 Patrick Jaap 2017-04-18 07:28:44 UTC
Hello,
I made a few investigations on the bug.

The horizontal lines are given in the docx file (header.xml) by
[…]
<a:off x="0" y="0"/>
<a:ext cx="5760085" cy="0"/>
[…]
<a:gd name="T0" fmla="*/ 0 w 8504"/>
<a:gd name="T1" fmla="*/ 8504 w 8504"/>
[…]
<a:path w="8504">
<a:moveTo><a:pt x="0" y="0"/>
</a:moveTo>
<a:lnTo>
<a:pt x="8504" y="0"/>
[…]

The lines are anchored at the header and have a width of 5760085 Emu. I don’t understand the “formula” completely, but I think there is an internal measurement in 8504 units and the line speads from 0 to 8504, thus the complete width. 

What LO does: it shows the green boundig rectangles completely in the right posiltion (!) but the rendered lines are misplaced.
Furthermore, placing the lines elsewhere or change their width leads always to a line of 8504 twip in width. 

So, the bounding rectangle is shown correctly, thus the importing is done right. But the rendering does not use the “formula” correctly. The rendered line is always 8504 twip long.

I hope the information is helpful.
Regards,
Patrick
Comment 6 Vasily Melenchuk (CIB) 2017-05-12 16:09:59 UTC
Bug is no longer reproduced with master. It was fixed as a tdf#107104.

Actual problem was in zero-height extent of shape. New test, based on original document was added: such situation was not checked before.

*** This bug has been marked as a duplicate of bug 107104 ***
Comment 7 Commit Notification 2017-05-12 16:12:09 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "master":

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

tdf#100072 extra test for DOCX shape import with zero height

It will be available in 5.4.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 8 Oliver Sander 2017-05-12 20:31:04 UTC
Created attachment 133277 [details]
The document as rendered by LO-5.4alpha1
Comment 9 Oliver Sander 2017-05-12 20:35:02 UTC
Many thanks! It looks a lot better now, but the issue is not completely fixed.  The horizontal bar should extend all the way to the right side of the logo in the upper right corner (see how MSOffice renders it in the second attachment).  However, with 

Version: 5.4.0.0.alpha1+
Build ID: 970b431f1a7b6b96c4c9536657ce4fe9d8f5b585

the line still ends about 1cm too far to the left.  So there must be something else.
Comment 10 Commit Notification 2017-05-18 12:19:43 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "master":

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

tdf#100072 zero height of shape's path was causing geometry errors

It will be available in 5.4.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 11 Vasily Melenchuk (CIB) 2017-05-18 12:29:31 UTC
Another issue causing difference was fixed. Both shape lines are right now corrent width and are in correct positions.
Comment 12 Commit Notification 2017-05-19 10:02:51 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "libreoffice-5-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d82ef41ecfb92a3d6b138cf5cbce4ea1407fc8d4&h=libreoffice-5-4

tdf#100072 zero height of shape's path was causing geometry errors

It will be available in 5.4.0.1.

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 13 Commit Notification 2017-05-30 22:42:13 UTC
Vasily Melenchuk committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9c3100a4b9f258a7dc0aff93bc01fa39f7501d2c&h=libreoffice-5-3

tdf#100072 zero height of shape's path was causing geometry errors

It will be available in 5.3.4.

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 14 vihsa 2017-05-31 04:44:12 UTC
per comment 11,verified, hence status change.