Bug 31077 - Copy/Paste from OOo Calc to LibreOffice Calc inserts OLE object
Summary: Copy/Paste from OOo Calc to LibreOffice Calc inserts OLE object
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All Windows (All)
: low minor
Assignee: Not Assigned
: 34108 (view as bug list)
Depends on:
Blocks: Paste
  Show dependency treegraph
Reported: 2010-10-24 04:25 UTC by GerardF
Modified: 2022-09-15 09:35 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:

Copiy of the result of copy/paste (15.82 KB, application/vnd.oasis.opendocument.spreadsheet)
2010-10-27 05:38 UTC, GerardF

Note You need to log in before you can comment on or make changes to this bug.
Description GerardF 2010-10-24 04:25:57 UTC
Version LibreOffice build

To reproduce :
Open a OpenOffice Calc document, select a cell (or cell range) and Copy.
Open LibreOffice Calc, Paste.

Instead of copying cell content (value, formula...) copy/paste insert OLE object.

Same result if you copy/paste from LibO to OOo.

Copying both from OOo and Libo to Excel or reverse (Excel → LibO) works fine.
Comment 1 Noel Power 2010-10-27 05:08:09 UTC Comment hidden (obsolete)
Comment 2 GerardF 2010-10-27 05:38:29 UTC
Created attachment 39809 [details]
Copiy of the result of copy/paste
Comment 3 GerardF 2010-10-27 05:42:00 UTC Comment hidden (obsolete)
Comment 4 Noel Power 2010-10-27 06:33:55 UTC
urm, I tried with your document and the same openoffice version, still works for me :-( So, maybe this really is a platform specific issue ( I am using Linux ), assigning to Tor to have a look
Comment 5 Don't use this account, use tml@iki.fi 2010-11-17 04:08:34 UTC
I think I can reproduce it, yes. When I paste a selection of cells with a couple of numbers and a formula from (vanilla) OOo into LibO, I get something with an anchor "button" in the top left corner and green resize handles along the border. I guess it is an OLE object. Ditto the other way.

Kohei, do you have insight what might be going on?
Comment 6 Don't use this account, use tml@iki.fi 2010-11-17 04:11:56 UTC
Note that it is not relevant whether the copy/pasted cells contain any formula or not; also just a single cell with a number gets pasted into LibreOffice as an OLE object.
Comment 7 Don't use this account, use tml@iki.fi 2010-11-18 08:47:40 UTC
Workaround added to LibreOffice: In ScViewFunc::PasteFromSystem(): If the class id of the TransferableObjectDescriptor is all-zero and the SYLK format is available on the clipboard, this seems to indicate the situation when copy-pasting from OOo Calc to LO Calc. In this case use the SYLK format data.

Note that this means that formulas will not be transfered, even if the SYLK format as such does seem to support at least simple formulas. But apparently the code in OOo/LO to generate SYLK for the clipboard does not handle formulas?

Nothing done for the other direction. But I guess that should be filed as a bug against OOo;)

This is just a questionable workaround. The correct fix, which would take much more work to implement, would be to make OOo (and LO) offer the Biff5 and/or Biff8 formats on the clipboard. There is already code to accept these, which gets used when copy-pasting from Excel, I think.

commit 27d40392c0164cd616c621b3500adac237a23ca2
Author: Tor Lillqvist <tlillqvist@novell.com>
Date:   Thu Nov 18 18:14:38 2010 +0200

    Add workaround to avoid pasting data from OOo Calc as an OLE object
    Help for fdo#31077.

diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index e374252..69d608d 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -680,6 +680,10 @@ void ScViewFunc::PasteFromSystem()
                 //     If it's a Writer object, insert RTF instead of OLE
+                //     Else, if the class id is all-zero, and SYLK is available,
+                //     it probably is spreadsheet cells that have been put 
+                //     on the clipboard by OOo, so use the SYLK. (fdo#31077)
                 BOOL bDoRtf = FALSE;
                 TransferableObjectDescriptor aObjDesc;
                 if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) )
@@ -690,6 +694,9 @@ void ScViewFunc::PasteFromSystem()
                 if ( bDoRtf )
                     PasteFromSystem( FORMAT_RTF );
+                else if ( aObjDesc.maClassName == SvGlobalName( 0,0,0,0,0,0,0,0,0,0,0 )
+                          && aDataHelper.HasFormat( SOT_FORMATSTR_ID_SYLK ))
+                    PasteFromSystem( SOT_FORMATSTR_ID_SYLK );
                     PasteFromSystem( SOT_FORMATSTR_ID_EMBED_SOURCE );
Comment 8 Don't use this account, use tml@iki.fi 2010-12-02 05:22:47 UTC
So, a workaround is in place, but I wouldn't call it a proper fix, so I am keeping this bug open.
Comment 9 Rainer Bielefeld Retired 2011-02-10 02:20:17 UTC
*** Bug 34108 has been marked as a duplicate of this bug. ***
Comment 10 Frank Steiner 2011-06-09 07:37:46 UTC Comment hidden (no-value)
Comment 11 Don't use this account, use tml@iki.fi 2011-06-09 07:52:43 UTC Comment hidden (no-value)
Comment 12 Frank Steiner 2011-06-10 01:14:45 UTC Comment hidden (no-value)
Comment 13 Don't use this account, use tml@iki.fi 2011-06-10 01:30:46 UTC Comment hidden (obsolete)
Comment 14 Björn Michaelsen 2011-12-23 11:33:33 UTC Comment hidden (obsolete)
Comment 15 sasha.libreoffice 2012-02-22 07:18:27 UTC Comment hidden (obsolete)
Comment 16 Roman Eisele 2012-05-03 09:10:35 UTC
This is a Calc bug, therefore modified the 'Component' field accordingly.

Hint: this bug is still open by the reasons mentioned in comment #8. But I can't tell if the reason mentioned in comment #8 is still true. Therefore:

@Tor Lillqvist:
Could you please have a quick look at this bug report and check
* if the reason for keeping this bug open you mentioned in comment #8 is still true (the bug is still not fixed properly, we have just a workaround) -- then please set the status of this bug again to NEW (or whatever you thing is appropriate),
* if the bug has been really fixed in between -- then please close this bug report.

Thank you very much!

I am just trying to sort out outdated bug reports, in order to make it easier to see the really important bugs ...
Comment 17 Don't use this account, use tml@iki.fi 2012-05-03 09:29:14 UTC Comment hidden (obsolete)
Comment 18 Kohei Yoshida 2012-05-03 20:28:54 UTC
(In reply to comment #17)
> Kohei, do you have any idea? Does LO offer Biff5 or Biff8 on the clipboard
> nowadays?

Nope, it still does not.  But in theory we could provide Biff8 to the clipboard with some effort, though that won't help pasting from OOo to us (unless OOo does the same modification in their clipboard code).

> (Assuming that is the proper fix, as I thought in comment #7.)

Yes, that's the proper fix.  That would also solve another issue (of pasting from Calc to Excel).
Comment 19 Florian Reisinger 2012-08-14 13:59:06 UTC Comment hidden (obsolete)
Comment 20 Florian Reisinger 2012-08-14 14:00:18 UTC Comment hidden (obsolete)
Comment 21 Florian Reisinger 2012-08-14 14:04:59 UTC Comment hidden (obsolete)
Comment 22 Florian Reisinger 2012-08-14 14:07:04 UTC Comment hidden (obsolete)
Comment 23 Regina Henschel 2012-08-14 14:32:56 UTC
The error still exists.

Mark range including formulas in Apache OpenOffice.
Goto LibreOffice
Ctrl-V oder use Edit>Paste Special or use drop-down list from Paste icon.
No format gives you the original formulas like a copy from one sheet to another.

It is a pity that LibreOffice can paste such data from Excel but not from a related project.
Comment 24 Florian Reisinger 2012-08-15 17:09:34 UTC Comment hidden (obsolete)
Comment 25 Roman Eisele 2012-08-16 08:58:03 UTC Comment hidden (obsolete)
Comment 26 Don't use this account, use tml@iki.fi 2012-08-16 09:11:30 UTC Comment hidden (obsolete)
Comment 27 Florian Reisinger 2012-08-16 09:56:13 UTC
Oka! I try to explain

1,2,=A1+A2 (3)

Imported from OO.org A3 shows the number 3, not the formula
Comment 28 Regina Henschel 2012-08-16 10:40:34 UTC
And the reason is the same as in the initial report: A wrong clipboard format is used. The clipboard format Calc8 is not detected.
Comment 29 Don't use this account, use tml@iki.fi 2012-08-16 10:41:19 UTC Comment hidden (no-value)
Comment 30 Florian Reisinger 2012-08-16 11:37:58 UTC Comment hidden (no-value)
Comment 31 QA Administrators 2014-10-23 17:31:43 UTC Comment hidden (obsolete)
Comment 32 Michael Bauer 2015-05-29 00:10:42 UTC Comment hidden (no-value)
Comment 33 QA Administrators 2016-09-20 09:45:54 UTC Comment hidden (obsolete)
Comment 34 Timur 2018-10-09 16:07:09 UTC
With LO 6.2+ is as in Comment 27, I guess as explained in Comment 7.
Comment 35 QA Administrators 2019-10-10 02:40:54 UTC Comment hidden (obsolete)
Comment 36 QA Administrators 2021-10-10 03:44:03 UTC Comment hidden (obsolete)
Comment 37 Hossein 2022-09-15 09:35:35 UTC
Not reproducible with:

Version: / LibreOffice Community
Build ID: f85e47c08ddd19c015c0114a68350214f7066f5a
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: fa-IR (en_US.UTF-8); UI: en-US
Calc: threaded

OpenOffice.org 3.2.1
OOO320m18 (Build:9502)

The contents were copied, and the described problem does not occur.