Bug 94457 - LibreOffice Draw generate a bad EMF file, incompatible with Microsoft Office Word
Summary: LibreOffice Draw generate a bad EMF file, incompatible with Microsoft Office ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
4.1 all versions
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:5.4.0 target:5.3.1 target:5.2.6
Keywords: regression
Depends on:
Blocks: EMF-WMF
  Show dependency treegraph
 
Reported: 2015-09-23 00:17 UTC by Gregory G.
Modified: 2017-01-26 14:07 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
EMF export bug - Files explaining the bug (135.48 KB, application/x-zip-compressed)
2015-09-23 00:17 UTC, Gregory G.
Details
EMF file (LibreOffice) NOT compatible with MS Word (6.31 KB, image/x-emf)
2015-09-23 00:22 UTC, Gregory G.
Details
EMF file (OpenOffice) compatible with MS Word (4.10 KB, image/x-emf)
2015-09-23 00:23 UTC, Gregory G.
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gregory G. 2015-09-23 00:17:47 UTC
Created attachment 118951 [details]
EMF export bug - Files explaining the bug

LibreOffice Draw generate an incorrect EMF file (Enhanced Metafile .emf), not compatible with Microsoft Office, when we want to save the .docx file to a PDF file with Word.


How to reproduce the bug:
1/ Create a drawing in Libre Office Draw

2/ Export it in EMF format.

3/ Create a new document with Microsoft Office Word 2013

4/Insert the EMF file generated by Libre Office. [menu: Insert -> Pictures]
The Picture is displayed in Word document.

5/ Create a PDF file with Word, using the build-in PDF creator 
[menu: File -> Save As -> PDF(*.pdf) ]

6/ Word display the following error message: 
"The export failed due to an unexpected error"
And the PDF file is not created.


By using an EMF file generated by OpenOffice 4.1.1, and by following the same steps, there is no issue, and the PDF file is created by Word properly, with the embedded vectorial file in it.
So the issue is linked to LibreOffice EMF Export.

Tested on : Microsoft Windows 7 SP1 (64bit), with Microsoft Office 2013 SP1 (32bit)

The issue occurs with all versions of LibreOffice.
EMF export issue Tested with :
	LibreOffice_4.3.2
	LibreOffice_4.4.5
	LibreOffice_5.0.1

The same issue occurs when generating an EMF file with LibreOffice Impress.
Comment 1 Gregory G. 2015-09-23 00:22:13 UTC
Created attachment 118952 [details]
EMF file (LibreOffice) NOT compatible with MS Word
Comment 2 Gregory G. 2015-09-23 00:23:08 UTC
Created attachment 118953 [details]
EMF file (OpenOffice) compatible with MS Word
Comment 3 Robinson Tryon (qubit) 2015-12-14 05:32:45 UTC Comment hidden (obsolete)
Comment 4 Joel Madero 2015-12-19 23:40:21 UTC
This was never confirmed by an independent QA member - OP set the bug to NEW. Setting to UNCONFIRMED.
Comment 5 Joel Madero 2015-12-19 23:41:10 UTC
Also - no clue why there is a bibisectRequest - OP says "The issue occurs with all versions of LibreOffice."
Comment 6 raal 2015-12-20 08:27:25 UTC
This seems to have begun at the below commit.
Adding Cc: to Caolán McNamara  ; Could you possibly take a look at this one?
Thanks
 a67b874d60de1f1a44bef57a53a7b8a84db0ba58 is the first bad commit
commit a67b874d60de1f1a44bef57a53a7b8a84db0ba58
Author: Bjoern Michaelsen <bjoern.michaelsen@canonical.com>
Date:   Tue Dec 11 03:32:02 2012 +0000

    source-hash-19f4ebd8a54da0ae03b9cc8481613e5cd20ee1e7
    
    commit 19f4ebd8a54da0ae03b9cc8481613e5cd20ee1e7
    Author:     Caolán McNamara <caolanm@redhat.com>
    AuthorDate: Mon Nov 12 21:17:37 2012 +0000
    Commit:     Caolán McNamara <caolanm@redhat.com>
    CommitDate: Tue Nov 13 09:49:18 2012 +0000
    
        use SetControlForeground instead of SetTextColor
    
        because that's persistent across unrelated style
        changes otherwise setting e.g. alignment will
        reset the color to default black
    
        Change-Id: I2b975c3914a59a93e54d72aa0975a066b5edf533

:100644 100644 6d85145f7ba0ead31c84e60a4f7ea59af07f4e83 29d96b0de6d16a73b1e9ff2ca8745b115e40d115 M	autogen.log
:100644 100644 5d2105bc5db0d97452b3f213d028567f7ef47f74 fc50744f3abcdc37e7e8ae63b5ee73f25bb1c6e9 M	ccache.log
:100644 100644 cb3471f771599c0198309b766b1119b4272134de 28c61ffba7e7adab533f7ff9a4f4f595e4439822 M	commitmsg
:100644 100644 ea177fc38ffa1376ecf167db31aadeae1ee62b34 144992024292b77d35ec3f94e2b3fd309f9d27f1 M	dev-install.log
:100644 100644 34bcd3ceb8be50720147e089fde247e8d90868b0 ae2cc20a3e3477e7b1845778dd570bf277812953 M	make.log
:040000 040000 21c1e97d1421f61bbbeb0734daeac98e43fe52a1 2c1a78c87a5e84fe1c2bafb167b87e7c85aed252 M	opt

bibisect-43all$ git bisect  log
# bad: [423a84c4f7068853974887d98442bc2a2d0cc91b] source-hash-c15927f20d4727c3b8de68497b6949e72f9e6e9e
# good: [65fd30f5cb4cdd37995a33420ed8273c0a29bf00] source-hash-d6cde02dbce8c28c6af836e2dc1120f8a6ef9932
git bisect start 'latest' 'oldest'
# bad: [e02439a3d6297a1f5334fa558ddec5ef4212c574] source-hash-6b8393474974d2af7a2cb3c47b3d5c081b550bdb
git bisect bad e02439a3d6297a1f5334fa558ddec5ef4212c574
# good: [8f4aeaad2f65d656328a451154142bb82efa4327] source-hash-1885266f274575327cdeee9852945a3e91f32f15
git bisect good 8f4aeaad2f65d656328a451154142bb82efa4327
# bad: [9995fae0d8a24ce31bcb5e9cd0459b69cfbf7a02] source-hash-8600bc24bbc9029e92bea6102bff2921bc10b33e
git bisect bad 9995fae0d8a24ce31bcb5e9cd0459b69cfbf7a02
# good: [51b63dca7427db64929ae1885d7cf1cc7eb0ba28] source-hash-806d18ae7b8c241fe90e49d3d370306769c50a10
git bisect good 51b63dca7427db64929ae1885d7cf1cc7eb0ba28
# bad: [d65a58c31c8da044ef66ae4517fa2fe74cec0019] source-hash-2e053cf5ea4d93a2e1845e795a9c7fe1e08c84af
git bisect bad d65a58c31c8da044ef66ae4517fa2fe74cec0019
# bad: [79e02001f27d33b3b478324ab6fba5683413b4d9] source-hash-b6c016da23d309b4ac7d154bc33a22397974ed73
git bisect bad 79e02001f27d33b3b478324ab6fba5683413b4d9
# good: [183a576d94de9a9439d580c8b81f335ab57cdbdc] source-hash-a599f5b4b51848e3b397d471c9d12b373caadcef
git bisect good 183a576d94de9a9439d580c8b81f335ab57cdbdc
# bad: [a67b874d60de1f1a44bef57a53a7b8a84db0ba58] source-hash-19f4ebd8a54da0ae03b9cc8481613e5cd20ee1e7
git bisect bad a67b874d60de1f1a44bef57a53a7b8a84db0ba58
# good: [7fd8bdb3b18f50ea0adbc0a5e611f6a844b23189] source-hash-a1ac2538e9b287444500618ab4d2f0f06c25cf34
git bisect good 7fd8bdb3b18f50ea0adbc0a5e611f6a844b23189
# first bad commit: [a67b874d60de1f1a44bef57a53a7b8a84db0ba58] source-hash-19f4ebd8a54da0ae03b9cc8481613e5cd20ee1e7
Comment 7 Xisco Faulí 2016-09-23 15:46:40 UTC
Removing keyword 'bisected' as the commit hasn't been identified but just the range: https://cgit.freedesktop.org/libreoffice/core/log/?qt=range&q=a1ac2538e9b287444500618ab4d2f0f06c25cf34..19f4ebd8a54da0ae03b9cc8481613e5cd20ee1e7
Comment 8 Xisco Faulí 2016-09-25 20:46:22 UTC
Hi raal,
Do you mind to bibisect this bug again with a max repository?
Comment 9 Xisco Faulí 2016-10-06 11:55:01 UTC
Already reproducible in Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Comment 10 OSS 2017-01-19 10:19:55 UTC
Can confirm this bug. I performed the following tests:

LibreOffice 5.2.4.2 on Ubuntu 16.04: emf is incorrect
LibreOffice 5.2.0.4 on Windows: emf is incorrect
LibreOffice 4.0.0.3 on Windows: emf is incorrect
LibreOffice 3.6.5.2 on Windows: emf is CORRECT
Comment 11 Caolán McNamara 2017-01-25 16:43:15 UTC
So I think our emfplus SetPageTransform record is written wrong
Comment 12 Commit Notification 2017-01-25 20:30:35 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

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

Resolves: tdf#94457 our EmfPlusSetPageTransform is malformed

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 13 Caolán McNamara 2017-01-25 20:43:01 UTC
as far as I can see this has been broken since the initial emfplus work, so the bisect seems off, anyhow, seem to work now and backports for 5-3 and 5-2 are in gerrit
Comment 14 Commit Notification 2017-01-26 14:05:31 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

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

Resolves: tdf#94457 our EmfPlusSetPageTransform is malformed

It will be available in 5.3.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.