Issue 113171 - OO does not paste the text contents of the Windows clipboard - instead, it pastes the previous text copied in OO
Summary: OO does not paste the text contents of the Windows clipboard - instead, it pa...
Status: CONFIRMED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows 7
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
: 110217 (view as issue list)
Depends on:
Blocks:
 
Reported: 2010-07-15 18:52 UTC by john_ha
Modified: 2022-03-11 11:34 UTC (History)
18 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description john_ha 2010-07-15 18:52:41 UTC
This is a frequent, but intermittent problem which occurs with Writer, Calc and
Impress, so I have posted it to API as it appears to be an API problem.

Essentially, I copy, say, "Fred" from an OO application.  I then copy, say "Tom"
from a non-OO application.  The Windows clipboard is shown to contain "Tom". 
BUT when I paste into any OO application, "Fred" gets pasted, not "Tom"!!  I can
stop this incorrect behaviour by copying anything else, say "Harry", from any OO
application, and now "Harry" is correctly pasted into all OO applications.

It appears as though OO retains "Fred" in an internal buffer and uses this
internal buffer when pasting instead of getting the correct data from the
Windows clipboard.  Copying something else from within OO somehow fixes the
problem, although it then may reoccur after a few correct copy/pastes.

The sequence is as follows:

1  Start MS ClipBook Viewer to allow the contents of the Windows clipboard to be
viewed

2  Copy the text "Fred" from an OO document (or spreadsheet or presentation) -
note it appears as "fred" in ClipBoard Viewer

3  Paste it to anywhere (OO, other application) - it pastes as "Fred"

4  Go to another application (Notepad, Firefox, Thunderbird etc) and copy "Tom"
- note it appears as "Tom" in ClipBoard Viewer

5  Paste (Ctrl/v or Edit > Paste) to anywhere - "Tom" gets pasted 

6  Paste (Ctrl/V or Edit > Paste) to Writer or Calc or Impress and "Fred" gets
pasted.  This is obviously wrong.

7  Repeat pasting to Writer or Calc or Impress and "Fred" is repeatedly pasted
although ClipBoard Viewer clearly shows the MS clipboard contains "Tom", and
"Tom" gets pasted into any non-OO application.

8  This incorrect behaviour may be terminated by copying anything from any OO
application - eg copy "Harry".  ClipBoard Viewer now shows "Harry" and paste
pastes "Harry" into all OO applications. 

9  Note that the Windows clipboard always contains the correct data.  The
problem is that OO does not gather the data it pastes from the Windows clipboard
- it seems to gather it from somewhere else, probably an internal OO buffer.   

Other factors

1  I am running Window Home Premium 64 bit on an HP p6203UK Pentium Dual Core
E5300 @2.6GHz, 4GB.  Other users have reported it with XP

2  I only see the problem with OO suggesting it is an OO API problem

3  Several other users have posted to various forums saying they have the same
problem

4  I posted a bug report to Writer "Paste from clipboard pastes the previous
contents of the clipboard" Issue 110217 but it is not being worked on as the
developers cannot reproduce the problem.
  
5  There is quite a lot of information on the web about similar failures with
Clipboard - this Mozilla forum entry seems to be the same problem and seems to
have been analysed as a race problem. 
http://netbeans.org/bugzilla/show_bug.cgi?id=88161.  

6  This is happening about 1 in 5 of my copy/pastes into OO.  When it starts to
happen, it repeats itself frequently. 
 
7  I do not have Selection Clipboard enabled in OO (so I cannot be inadvertently
doing anything by mouse select)

8  I have uninstalled and reinstalled OO and it still happens.
Comment 1 john_ha 2010-08-01 11:28:12 UTC
OO has a long delay (several seconds) before copied text is placed on the
Windows Clipboard.

When I copy some text from any other application, the contents of the Windows
Clipboard are immediately cleared and the copied text immediately appears in the
Clipboard.

But when I copy some text (ctrl/c or Edit > Copy) from an OO document, while the
Clipboard is immediately cleared, the copied text does not appear in the
Clipboard until several seconds later.  

During the period that the Clipboard is empty, if I paste into any other
application, nothing is pasted (correct - the Clipboard is empty).  BUT if I
paste into any OO document while the Clipboard is empty, the copied text is pasted.

So, OO appears to be holding the copied text in an internal buffer and OO is not
pasting it to the Windows Clipboard until a delay of several seconds.

This internal buffer may be the reason for the behaviour reported in this bug
report, namely "OO does not paste the text contents of the Windows clipboard -
instead, it pastes the previous text copied in OO" 

I am now running OOO320m18 Build:9502
Comment 2 john_ha 2010-08-01 11:45:55 UTC
I am checking the Clipboard using MS Clipboard Viewer clipbrd.exe.  

The delay only occurs if clipbrd.exe is started before OO.  If OO is started
before clipbrd.exe, the delay does not occur.

Please note that the original problem of OO pasting the previous contents occurs
when clipbrd.exe is not running.  I only use clipbrd.exe to assist debugging.

This delay with Clipboard viewers appears to be well known.  Searching on 'copy
paste delay' finds a number of issues including 49907.  

Note that the user does not need to be running a Clipboard viewer to experience
the delays because some applications apparently silently monitor the Clipboard
without telling the user (by calls the MS API function called SetClipboardViewer().)
Comment 3 jsc 2010-08-02 10:25:57 UTC
jsc -> cd: do you know who takes care of the clipboard? Is it related to the
framework? 
Comment 4 john_ha 2010-08-14 11:43:15 UTC
jsc

Have you found out who looks after the Clipboard?

I have been digging, and it appears that it might be a Windows 7 and Vista
problem with the clipboard.  See
http://technet.microsoft.com/en-us/library/cc749442%28WS.10%29.aspx which says
there are several issues with MS Clipboard and offers fixes for it.  eg the site
says:

When the copy or paste operation does not function properly, the fix called
EmptyClipboardtoSet fixes applications that call the SetClipboardData(CF_TEXT)
function without first emptying the Clipboard.

Also, I saw in another post (
http://user.services.openoffice.org/en/forum/viewtopic.php?f=15&t=28669&p=151107#p151107
) that OO apparently does not use the new changed, Clipboard format as below:  

In short, OpenOffice writer does not generate the correct CF_HTML format to put
into the clipboard.

According to HTML Clipboard Format
(http://msdn.microsoft.com/en-us/library/ms649015(VS.85).aspx), the HTML
comments <!--StartFragment--> and <!--EndFragment--> need to be present in the data:

The fragment should be preceded and followed by the HTML comments
<!--StartFragment--> and <!--EndFragment--> (no space allowed between the !--
and the text) to conveniently indicate where the fragment starts and ends. Thus
the start and end of the fragment are indicated by the presence of these
comments and by StartFragment and EndFragment byte counts in the description.
Tools are expected to produce this information. This redundancy has been
introduced to be able to rapidly find the start of the fragment (from the byte
count) and mark the position of the fragment directly in the HTML tree.

However, OpenOffice writer does not respect this and produce the HTML format
data without the required comments, like the following:

Version:1.0
StartHTML:0000000168
EndHTML:0000000656
StartFragment:0000000591
EndFragment:0000000639
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
...
</HEAD>
<BODY LANG="en-US" DIR="LTR">
<P STYLE="margin-bottom: 0in"><B>Foo</B></P>
</BODY>
</HTML>
Comment 5 michael.ruess 2010-09-02 14:30:37 UTC
*** Issue 110217 has been marked as a duplicate of this issue. ***
Comment 6 carsten.driesner 2010-09-02 15:13:16 UTC
cd: Set target to 3.4. I am busy with 3.3 show stoppers. The Windows specific
clipboard code in OOo has several problems. There are known deadlocks with some
automatic tests which use the clipboard. I will try to have a look at this issue
when I have more time for non-showstopper bugs.
Comment 7 isaac_s 2010-09-02 16:12:06 UTC
Happens on Windows XP SP3 32bit as well
Comment 8 john_ha 2010-09-05 11:17:58 UTC
John_Ha > cd

Thank you.  I understand how difficult it is to debug and test intermittent
problems.  

I will be very pleased to test any fixes you write on the machine which is
causing the problem.  All updates to this bug report are sent to my email ID so
if you would like me to do any testing, just post here and I will get it.

I have worked in the IT industry for many years and while I am not a PC/Windows
specialist, I believe that I can report accurately on my experiences with any
test modules. 
Comment 9 rcal 2010-09-08 15:25:02 UTC
I have the same issue. 
Ooo portable 3.2.0, windows XP. (not possible to install Ooo mainstream, because
it needs admin rights, now).
this is a major issue. 
We would like to diffuse Ooo into our 7.000 staff company: this kills
definitively any possibility to diffuse it. 

This has been discussed also here:
http://user.services.openoffice.org/en/forum/viewtopic.php?f=15&t=24973
Comment 10 john_ha 2010-11-30 10:41:52 UTC
I saw that there was some work done on the clipboard in v3.3, so I downloaded
OOo3.3.0 Release candidate 6 OOO330m17 Build 9551 but, as I unfortunately
expected, the problem still occurs.

I am looking forward to a fix in 3.4 and I will be pleased to test any patches.
Comment 11 john_ha 2010-11-30 11:37:17 UTC
Some more debugging results with 3.3 Release candidate 6.

I opened an instance of OO Writer and an instance of another application
(Notepad or Thunderbird - it happens with both but I think it may happen more
often with Thunderbird).  I copied Fred in OO to set up the test.  All
copy/pastes are Ctrl/c or /v

I then copied Tom in Notepad, pasted into OO, copied Fred in OO; copied Tom in
Notepad, pasted into OO, copied Fred in OO; ...  Initially, Tom got pasted, and
I repeated this sequence until pasting into OO wrongly pasted Fred.
  
Conclusion.  OO has not captured that something new, Tom, has been placed on the
Windows clipboard.  When I paste into Notepad, Tom gets pasted as expected.

I now repeatedly paste into OO >>> Fred is always wrongly pasted.

I wait 1 minute, and paste into OO >>> Fred is wrongly pasted.

I open a new OO Writer document (File > New > text doc) and paste into the new
text document.  Fred is wrongly pasted.

Conclusion.  The new document shares the same "buffer" as the original OO
document which is why it wrongly pastes Fred????

I now repeatedly copy Tom from Notepad, paste into OO; copy Tom from Notepad,
paste into OO; ... and repeat.  Every time I paste into either of the OO
documents, Fred wrongly gets pasted.  

Conclusion.  When in the "wrong state" OO does not capture when something new is
placed on the Windows clipboard.  But, not always!  While editing this post (in
Firefox), I had left OO running.  I copied text in this post to move it.  When I
returned to OO, and pasted, the text from this post was pasted into OO. 
Somehow, during a delay of several minutes, OO reset itself.  

The only way to get OO working properly is to copy something in OO.  This
usually (90%), but not always, "resets" OO, and OO starts working correctly again.

When I close all instances of OO and start a completely new test, the problem
typically begins after 5 or 6 copies.
Comment 12 rcal 2010-11-30 13:16:39 UTC
Workaround: 

I discovered that if I move a text or an image from word to openoffice, with the
mouse, without copy & pasting, it works, even when copy & past with the keyboard
do not work. 

However, this is only a workaround. 

Of course this is a "killing problem" for openoffice, that should be resolved ASAP. 
Comment 13 john_ha 2010-11-30 21:26:38 UTC
> rcal
Thank you for that workaround - I did not know about it.  It works for me
copying from Thunderbird (which supports mouse_copy) but not copying from
Notepad (which does not seem to support mouse_copy).

The process is
1  OO is in its funny state where it always pastes Fred no matter how many times
I copy Tom from another application
2  Highlight APPLE in Thunderbird (or other high-level application).  Drag it
with the mouse to OO and drop it in OO >>> APPLE is pasted into OO which is correct.
3  Ctrl/v in OO and Fred is pasted, which is wrong.

Note that I still have OO > Tools > Options > OO.org > View > Middle mouse
button set to No Function.  I am never therefore using Mouse Select. 
Comment 14 thomasjk 2011-01-11 19:07:41 UTC
*** Issue 113171 has been confirmed by votes. ***
Comment 15 alex.thurgood 2011-03-07 15:07:28 UTC
More info :

This also happens on Mac OSX 10.6.6 with OOo 3.3.0 final, so not just the Windows clipboard. Repeatedly with Base, I can only copy data from a table or query once or twice via Cmd-C / Cmd-V to another app or even Calc or Writer.


I would change platform to all, but hmm, seems that one can not change platform anymore ??


Alex
Comment 16 francisjoseal 2013-08-02 09:43:27 UTC
As reported by john_ha<john.ha24z@yahoo.co.uk>
"john_ha 2010-07-15 18:52:41 UTC
This is a frequent, but intermittent problem which occurs with Writer, Calc and
Impress, so I have posted it to API as it appears to be an API problem.

Essentially, I copy, say, "Fred" from an OO application.  I then copy, say "Tom"
from a non-OO application.  The Windows clipboard is shown to contain "Tom". 
BUT when I paste into any OO application, "Fred" gets pasted, not "Tom"!!  I can
stop this incorrect behaviour by copying anything else, say "Harry", from any OO
application, and now "Harry" is correctly pasted into all OO applications.

It appears as though OO retains "Fred" in an internal buffer and uses this
internal buffer when pasting instead of getting the correct data from the
Windows clipboard.  Copying something else from within OO somehow fixes the
problem, although it then may reoccur after a few correct copy/pastes."

I have faced a similar problem in Windows 8 machine(64 bit) while using Open Office Org Writer 3.4.1. 

Please rectify the error at the earliest.

Regards,
Francis
Comment 17 Regina Henschel 2013-08-02 21:57:37 UTC
Window has a program 'clipbrd.exe' to show the content of Window's clipboard. If I copy something from OpenOffice, it takes about 4 seconds till it is visible in the clipboard. For all other applications it appears in the clipboard immediately.

So there is surely something wrong in the kind of OpenOffice uses the system clipboard. Getting the wrong text might have its reason in this delay.
Comment 18 Pieter 2013-08-27 09:55:54 UTC
I'm using Windows 8 with Classic Shell and I have the same intermittent problem, which is quite a nuisance and costs me considerable amounts of both time and money. Is there a fix out already? I do appreciate OO very much and I hope you guys can find a solution.
Comment 19 EKCarpenter 2014-01-06 17:49:51 UTC
Confirming that this bug also occurs under Windows 8 64-bit with OpenOffice 4.0.0.
Comment 20 lideln 2014-01-23 11:23:37 UTC
Same bug here on Windows 7 64 bits and Open Office 4.0.1

This is a *major* bug, that has been going on for 4 years and multiple versions of OO (first time reported here in 2010 in bug report 110217)

This is critical, please find the time to fix it.

Best regards,
Comment 21 Armin Le Grand 2014-01-23 17:47:01 UTC
Just tried with AOO410m1(Build:9750)  -  Rev. 1555399 and Notepad on Win7, copied Tom?Fred vice-versa for some minutes, all went as expected. Cannot confirm.
Comment 22 John 2014-02-17 21:09:03 UTC
I was the original poster of this bug and when I posted it I was seeing the problem very frequently.

Over the years the problem seems to have disappeared and I cannot remember the last time it happened to me. I edit a 15 page magazine in alternate months and make extensive use of copy and paste.  My wife has never seen the problem on her laptop (Lenovo dual core, W7 Home, 64bit).  

I am running the same hardware (HP dual core) and software (W7 Home 64bit) now as I was when I reported the problem so I came to the conclusion that it had been fixed, either as a result of this bug report (Comment 6), or as a result of fixing other things with the clipboard, or by MS as a W7 update.  I

I did also wonder if it was a "timing race" problem which only occurs on some hardware/software combinations.
Comment 23 Krista 2014-06-19 13:29:40 UTC
I am experiencing this issue as well with OO version 4.1. My users can do about 2 or 3 successful copy/pastes - and then it stops working. I ran the clipboard viewer to see how the OS takes the commands with this, and its perfectly fine. We are running windows 7. At this point copy/paste is not functional at all! This needs a fix asap!! The issue has existed with OO for almost 5 years! Please provide a fix for this bug!
Comment 24 robert 2015-01-28 08:38:53 UTC
5 years later and this problem still occurs and haven't been fixed yet.
Comment 25 Femke Pilkes 2015-11-19 20:24:48 UTC
MS Surface Pro 3, Windows 10 and this again or still is not working ... it's apparently not a 'big thing' but basically I can not create a presentation as I can not copy pictures from my snapshot tool nor can I copy internet links etc ... I have to admit I am considering taking a subscription to MS Office .. it's not the only hassle in OO .... (sorry)
Comment 26 orcmid 2016-03-03 21:06:39 UTC
Issue 126858 has also been opened on a specific case of this.  That one has additional analysis of the specific case of the latest addition to the clipboard not being pasted along with verification that the clipboard has indeed been updated.
Comment 27 John 2016-03-03 22:22:18 UTC
I am the original poster.  I have been re-reading this thread and Issue 126858 and something caught my eye - is it a timing / slow response problem?

If anyone is still having this problem then, next time it happens, just wait for 10? 20? 30? seconds and see if it fixes itself.

Why?  See Comment 4 in  Issue 126858 which says:

"I noticed, when i do not use the clipboard for a longer time, the copy/paste function continues to work."

See Comment 1 here which says:

"OO has a long delay (several seconds) before copied text is placed on the
Windows Clipboard."

Could this be related to the problem?
Comment 28 orcmid 2016-03-03 23:00:29 UTC
(In reply to John from comment #27)
[ ... ]
> See Comment 1 here which says:
> 
> "OO has a long delay (several seconds) before copied text is placed on the
> Windows Clipboard."
> 
> Could this be related to the problem?

There may well be timing issues.  On the other hand, on this thread, the user was copying from a non-AOO application into an AOO application (Writer or Calc).

You raise another good point though.

Applications do not have to put information on the clipboard immediately, although they do put *something* on the clipboard.  The actual content need not be piped through until a paste option is chosen and the paste starts in the destination application.  (drag and drop is similar).

If an application closes with a clipboard copy still on offer, it might then have to actually put the full content on the clipboard (and paste options might be limited in that case).  Some applications will ask whether you want the clipboard copy that is offered to be preserved or not when the application is closing.
Comment 29 orcmid 2016-03-03 23:02:39 UTC
(In reply to orcmid from comment #28)
> (In reply to John from comment #27)
> [ ... ]
> > See Comment 1 here which says:
> > 
> > "OO has a long delay (several seconds) before copied text is placed on the
> > Windows Clipboard."
> > 
> > Could this be related to the problem?
> 
> There may well be timing issues.  On the other hand, on this thread, the
> user was copying from a non-AOO application into an AOO application (Writer
> or Calc).
Actually, it is on the other thread, Issue 126858 where the copying from an AOO-external source is involved.  I am confusing myself [;<).
Comment 30 John 2016-03-04 08:52:53 UTC
orcmid

> You raise another good point though.

I assure you it was more through luck than good judgement!!

May I point you to Comment 12 above which says: 

"if I move a text or an image from word to openoffice, with the mouse, without copy & pasting, it works, even when copy & paste with the keyboard do not work"

Might this be relevant or help narrow down the area?
Comment 31 John 2016-03-04 10:22:52 UTC
orcmid

See my Comment 11 above which says

"... I had left OO running ... Somehow, during a delay of several minutes, OO reset itself."

So I think I have already done my suggested my test - "next time it happens, just wait for 10? 20? 30? seconds and see if it fixes itself" - in Comment 27.  AOO does indeded 'reset' itself.

I think timing would probably be a fruitful avenue to investigate.
Comment 32 John 2017-02-01 11:57:16 UTC
What appears to be the identical bug is present in Libreoffice suggesting the cause is in the common OOo code.  

See Bug 62196 - EDITING: copy-paste from non-LibO-text-source pastes previous clipboard contents at https://bugs.documentfoundation.org/show_bug.cgi?id=62196
Comment 33 Mossman 2018-10-16 02:51:19 UTC
This issue still hasn't been fixed.  Is anybody working on this?  Makes it kind of useless as a research tool if I can't copy text from various sources and paste them into a document.
Comment 34 Peter 2018-10-16 05:12:24 UTC
If you follow the discussion, it seems not easy to reproduce.
Also there seems to be weather a timing issue.

Would you please state your OS, OpenOffice Version and a description when it occured? - I think we need more info.

And no no one is working on this, but I put this on the monitoring list.
Comment 35 John 2018-10-16 08:54:54 UTC
(In reply to Mossman from comment #33)
> This issue still hasn't been fixed.

See comment 22 - this is a strange problem and may even be specific hardware related.
Comment 36 John 2018-10-16 10:03:22 UTC
(In reply to Mossman from comment #33)
> This issue still hasn't been fixed.  Is anybody working on this?  Makes it
> kind of useless as a research tool if I can't copy text from various sources
> and paste them into a document.

You would do well to post this problem in the User Forum at https://forum.openoffice.org/en/forum/index.php where you will receive advice.

However, try this.  

Reset your user profile and please report back if it fixes the problem.  

On Windows 7
 
1.  START > CONTROL PANEL > FOLDER OPTIONS > VIEW > tick SHOW HIDDEN FILES, FOLDERS AND DRIVES

2.  Stop AOO.

3.  Rename C:\Users\xxxxxxn\AppData\Roaming\OpenOffice\4\user to ...\user_old (so you have it in case you need it again - xxxxxx is your username.)

4.  Start AOO. This creates a default ...\user - ie a new default Profile.

Is it now OK?

If it is now OK then copy back everything in C:\Users\xxxxxx\AppData\Roaming\OpenOffice\4\user_old\*.* to ...\user\*.* EXCEPT DO NOT COPY BACK registrymodifications.xcu or ...\config. This will bring back all your custom words added to dictionaries, autocorrects, macros, ..., etc.
Comment 37 John 2018-10-16 10:06:39 UTC
For 

2.  Stop AOO.

Read

2.  Stop AOO and the AOO Quickstarter if you have it enabled
Comment 38 Peter 2019-09-09 09:39:08 UTC
We have encountered the same problem on Windows 7 and now on Windows 10 on several PCs.

There has been proposals to "clear" the Cclipboard by issuing the command: 
cmd.exe /c “echo off | clip”
This does not work. Just tested.
Another porposal to make a screenshot also does not work.

Closing the OO software completely and reopen works fine. 
Just close the relevant document does NOT work.

The problem is the same on OO and on LibreOffice, too.
Older problems of OO and the newest stable Libre Office have botrh this problem.

In our cases, the problem just only happens, when something from an external application like Firefox or Writer or Word is copied into OO or LO through the clipboard. There is no difference to copy it by copy-C or right click mouse | copy.
We can use drag | drop with left click mouse and pull into OO or LO.
But this is not alwayse the best workable solution.

We might now change back to Microsoft Office because this problem has now - after 20 years of StartOffice, OpenOffice, LibreOffice - created so much frustration, that I cannot accept to work like this any more.

Would be glad to hear one day, that this problem is fixed.
Comment 39 John 2022-03-11 11:34:44 UTC
See Paste from external program to Writer not working at https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=107293#p522162
where it is reported that using a macro to open and close the clipboard before doing a paste prevents this behaviour.  

While not a perfect solution I would have thought it should be fairly simple and non-disruptive to add the Open and close clipboard code to the Copy/Paste code.

    Private Declare Function CloseClipboard Lib "user32" () As Long
    Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long

sub Openandcloseclipboardthenpaste
dim a as variant
        OpenClipboard a
        CloseClipboard
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
end sub