Bug Hunting Session
Bug 35176 - Can't paste image from MS Office and other Windows Apps (See Dupes)
Summary: Can't paste image from MS Office and other Windows Apps (See Dupes)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86 (IA32) Windows (All)
: high major
Assignee: Not Assigned
URL:
Whiteboard: NoRepro:4.2.0.3:OSX NoRepro:4.2.0.3:Win8
Keywords:
: 47655 59236 73045 73912 74612 84275 (view as bug list)
Depends on:
Blocks: Paste-From-MSO UX RTF-Images
  Show dependency treegraph
 
Reported: 2011-03-10 05:30 UTC by sasha.libreoffice
Modified: 2018-09-18 19:38 UTC (History)
17 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sasha.libreoffice 2011-03-10 05:30:51 UTC
To reproduce this problem start MS Word and place any picture into document. Then press Ctrl-A and Ctrl-C then in Writer press Ctrl-V. There appears only empty frame with text on top:
file:///C:\DOCUME~1\074F~1\LOCALS~1\Temp\msohtml1\01\clip_image002.jpg
if double click this appears dialog Picture and there in Tab Picture appears correct preview of picture.
In Draw and Impress paste picture works correctly.
produced on windows XP 32 bit russian, MSword 2003, Libreoffice 3.3.1.2
Comment 1 Don't use this account, use tml@iki.fi 2011-03-10 05:42:49 UTC
Note that if you Select All of the document in Word and copy it to the clipboard, then you aren't copying just the picture, but also the rest of the document, even if there is nothing else in it. The behaviour is different if you select just the image and copy that. Unfortunately, not much better;)

I tried the various possibilities offered in Paste Special, but none of them works as expected either, and some made Writer crash even.

This seems to be a disaster area.
Comment 2 Don't use this account, use tml@iki.fi 2011-03-10 05:58:43 UTC
If I Select All and Copy, the formats offered on the clipboard are:

49161: DataObject
49166: Object Descriptor
49282: Rich Text Format
49363: HTML Format
1: CF_TEXT
13: CF_UNICODETEXT
14: CF_ENHMETAFILE
3: CF_METAFILEPICT
49163: Embed Source
49156: Native
49155: OwnerLink
49165: Link Source
49167: Link Source Descriptor
49154: ObjectLink
49171: Ole Private Data
16: CF_LOCALE
7: CF_OEMTEXT

If I select just the image and Copy, the formats are:

49161: DataObject
49917: Art::GVML ClipFormat
2: CF_BITMAP
49912: PNG
49910: JFIF
49908: GIF
14: CF_ENHMETAFILE
3: CF_METAFILEPICT
49166: Object Descriptor
49171: Ole Private Data
8: CF_DIB
17: CF_DIBV5

Note especially that in this case there are some actual image formats there.

Anyway, I first tested with a slightly older build of LibreOffice I had installed, but now I installed 3.3.1. I now notice that if I Paste Special and choose the "Formatted Text [RTF]" or "GDI metafile" format, it works fine. Also the "Microsoft Word Document" format almost works, but there the image part of the pasted document fragment gets resized to a square. I can't get Writer to crash in LibreOffice 3.3.1.

If I choose the "HTML format without comments" format the result is the same as in a plain Paste. So is that what it does by default? In that case I guess we need to tweak the preferences for formats in some place, and prefer RTF to HTML? (This sounds vaguely familiar, we probably have some similar bug already open, maybe in bnc.)

Cédric, opinions?
Comment 3 Don't use this account, use tml@iki.fi 2011-03-10 06:42:07 UTC
Resetting to medium:normal as I can't make it crash in 3.3.1.

To repeat: The workaround to use Edit>Paste Special>Formatted text [RTF] seems to work fine.
Comment 4 Stephan Zietsman 2011-05-09 00:09:35 UTC
I get the same results as described. I.e. pasting an image in Word 2007, select-all (ctrl+a), copy (ctrl+c).  Open new Writer document (in LibO), paste (ctrl+v).  The image is pasted only showing a path (no image seen).  Double-clicking on image (or right-click -> picture...) and selecting the "Picture" tab shows preview correctly.

The workaround as described (pasting as RTF format) also works as described.  However, pasting as "GDI metafile" has slightly strange behaviour.  If the image is alone or if there is text AFTER the image, it works fine.  If there is text BEFORE the image, then the image does not display when pasted (there is a blank space where the image would normally appear, it looks like the blank area is as large as the image).  Can someone please advise if this should be reported as a separate bug?

--------
LibreOfficePortable (as from portableApps.com)

LibreOffice 3.3.2 
OOO330m19 (Build:202)
tag libreoffice-3.3.2.2

Microsoft Office Word 2007 (12.0.6425.1000) SP2 MSO (12.0.6554.5001)
Part of Microsoft Office Enterprise 2007

Win7 64bit
Comment 5 Björn Michaelsen 2011-12-23 11:50:47 UTC Comment hidden (obsolete)
Comment 6 sasha.libreoffice 2012-02-16 04:20:34 UTC
reproduced in 3.5.0 beta 3 on Windows XP 32 bit
Comment 7 sasha.libreoffice 2012-06-14 04:11:01 UTC
*** Bug 47655 has been marked as a duplicate of this bug. ***
Comment 8 bfoman (inactive) 2013-08-15 15:51:49 UTC
(In reply to comment #4)
> I get the same results as described. I.e. pasting an image in Word 2007,
> select-all (ctrl+a), copy (ctrl+c).  Open new Writer document (in LibO),
> paste (ctrl+v).  The image is pasted only showing a path (no image seen). 
> Double-clicking on image (or right-click -> picture...) and selecting the
> "Picture" tab shows preview correctly.
> The workaround as described (pasting as RTF format) also works as described.

Confirmed with:
Version: 4.2.0.0.alpha0+
Build ID: 087a610fcd5c0c354a9ed6bfccd3451b667d62a3
TinderBox: Win-x86@6-debug, Branch:master, Time: 2013-08-04_21:41:24
Windows 8.1 Enterprise Preview 64 bit

The same results copying from Word 2013.
Comment 9 Cédric Bosdonnat 2014-01-20 08:57:45 UTC
Restricted my LibreOffice hacking area
Comment 10 Maxim Monastirsky 2014-01-28 14:16:31 UTC
*** Bug 59236 has been marked as a duplicate of this bug. ***
Comment 11 retired 2014-01-29 10:36:03 UTC
NoRepro:4.2.0.3:OSX
NoRepro:4.2.0.3:Win8

Also when pasting into LO 4.2.0.3 in a win8 vm this is no longer reproducible.

Please re-open if this is still happening to you with LO 4.2.0.3 or newer.

http://www.libreoffice.org/download/pre-releases/
Comment 12 Luke 2014-01-30 18:45:13 UTC
Version: 4.2.0.4
Build ID: 05dceb5d363845f2cf968344d7adab8dcfb2ba71

MSO 2007 on Window 7 64-bit tested the attached bacon file. Result FAIL. 
MSO 2003 on Window 7 32-bit tested the attached bacon file. Result FAIL.
Comment 13 Maxim Monastirsky 2014-02-06 20:37:40 UTC
*** Bug 74612 has been marked as a duplicate of this bug. ***
Comment 14 Luke 2014-02-06 22:12:07 UTC
This bug goes back to OpenOffice 1.1 https://issues.apache.org/ooo/show_bug.cgi?id=14613

With LO 4.1.4 using picture from attachment 92563 [details]

1) Paste normal:
Result - FAIL

2) Paste special (GDI)
Result - PASS

3) Paste special (Bitmap)
Result - FAIL 
nothing was pasted

4) Paste special (html)
Result - FAIL
same as 1)

It appears that the paste detection code in Writer and Calc is broken. It is using the html format instead of GDI.

This is a major issue affecting people that want to continue to use Outlook for email, while migrating to LibreOffice.
Comment 15 Joel Madero 2015-05-02 15:42:28 UTC Comment hidden (obsolete)
Comment 16 Luke 2015-05-04 04:07:39 UTC
The bug is still present

Tested with Word 2013 using picture from attachment 92563 [details] on Win 7
LO Version: 5.0.0.0.alpha1+
Build ID: d8cb22fe8e1a7fbe8dda8f09483161468ffbce48
Comment 17 Luke 2016-05-11 17:45:53 UTC
With Win 10, Word 2013 -> Writer still not working on: V 5.2.0.0.alpha1+
Build ID: 4266caadbbe67fa23de0df3b84f4d923cfd57201

The Calc version of this bug was fixed somewhere between 4.3 to 4.4. You can now paste images from MSO to Calc and Impress, which has always worked.
Comment 18 Buovjaga 2016-05-14 15:33:26 UTC
*** Bug 94436 has been marked as a duplicate of this bug. ***
Comment 19 Buovjaga 2016-05-14 15:33:48 UTC
*** Bug 99507 has been marked as a duplicate of this bug. ***
Comment 20 Luke 2016-05-14 17:13:28 UTC
The 4.3.x branch resolved this issue with the Copy and Paste code in Calc. If we can locate this commit it should help greatly in fixing the Writer's problem. I'm putting a bisect request out there.
Comment 21 Luke 2016-05-17 00:58:31 UTC
*** Bug 73045 has been marked as a duplicate of this bug. ***
Comment 22 Luke 2016-05-17 00:58:58 UTC
*** Bug 73912 has been marked as a duplicate of this bug. ***
Comment 23 Luke 2016-05-27 16:41:49 UTC
When trying to find how Calc fixed this issue, I discovered it actually fixed in 4.4 with:
https://cgit.freedesktop.org/libreoffice/core/commit/sot/source/base/formats.cxx?id=538c13f3d1756f2d105115f64ab1bc0b7426eebc

It was then broken again by:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=a96a7ce51aa98fb9ee97ea3803e2b7e648611008

To fix Bug 81835
Comment 24 Luke 2017-01-08 20:22:16 UTC
*** Bug 84275 has been marked as a duplicate of this bug. ***
Comment 25 Luke 2017-12-05 22:00:53 UTC
Still reproducible with Version: 6.1.0.0.alpha0+ (x64)
Build ID: eff70347190a6642fd62a9e0b20e4366c39fbc7a
Comment 26 Roman Kuznetsov 2018-02-19 15:16:02 UTC
If use command "Paste Special > Formatted text [RTF]" then paste works fine
Comment 27 Luke 2018-09-18 17:30:12 UTC
In Version: 6.2.0.0.alpha0+ (x64)
Build ID: ae0d1f3af9ae129c3a7d98a544e0c9b0c30659c7

No repo with mixture of text+image or CTRL+A then CTRL+C of attachment 92563 [details]

Copy of image only still broken, but that is tracked in Bug 108966
Comment 28 Luke 2018-09-18 19:16:29 UTC
Miklos fixed this issue with
https://cgit.freedesktop.org/libreoffice/core/commit/?id=29d4ecf32392bc94ab0ba9e73fd79eba65c23fdb

By making RTF a higher priority than HTML.


Note: Need Word 2007-2013 to reproduce. Word 2016's HTML output is a different format and works in every version of LO and AOO that I tested.


Thanks Miklos!
Comment 29 Luke 2018-09-18 19:26:21 UTC
*** Bug 47655 has been marked as a duplicate of this bug. ***