Issue 51267 - cannot copy data from custom java jtable via clipboard
Summary: cannot copy data from custom java jtable via clipboard
Status: CLOSED DUPLICATE of issue 83004
Alias: None
Product: General
Classification: Code
Component: ui (show other issues)
Version: 680m109
Hardware: PC Windows 2000
: P3 Trivial with 3 votes (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-27 15:50 UTC by megadix
Modified: 2016-10-20 17:59 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description megadix 2005-06-27 15:50:51 UTC
Many Java applications use custom JTable implementations, for example:
- SQuirrel SQL client
- JMAtrix Databrowser
and many others; anyway, this defect has been tested on these two apps.

Use case:
- open the Java application that uses custom JTable implementation
- select a rectangular area
- copy (usual CTRL-C)
- switch to Calc
- try to paste (CTRL-V): an information dialog pops-up saying "The contents of
the clipboard could not be pasted"

The mime type for Java strings is (taken from java.awt.datatransfer.DataFlavor
javadocs):
application/x-java-serialized-object

The problem disappears using plain JTable, wich happens in no more than 1% of
Java apps...
Comment 1 megadix 2005-06-28 13:43:46 UTC
The various OOo programs behave quite differently:

- in Writer the message is:
"Requested clipboard format is not available"

- in Impress and Draw the content is pasted as a tab-separated text
Comment 2 thorsten.martens 2005-06-30 09:38:17 UTC
TM->requirements: Please have a look. This is not a defect but might be a wish
for an enhancement. 
Comment 3 megadix 2005-08-03 08:08:52 UTC
Sun filed a bug report for this, see:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6304958

Now let's enter the competition: who will win the race ?
Comment 4 megadix 2005-08-11 11:55:25 UTC
A useful link:

http://www.javaworld.com/javaworld/javatips/jw-javatip77.html
Comment 5 megadix 2005-11-16 15:05:58 UTC
Sun updated bug 6304958 with an interesting evaluation: see link above, section
"Evaluation"
Comment 6 fvrsintef 2006-01-26 13:20:13 UTC
The reason copy & paste of text/html from Java to e.g. OpenOffice Writer doesn't
work (tested with JDK 1.5.0_06 in Windows XP, OpenOffice 2.0.1) seems to be that
Java sets the StartHTML and EndHTML properties of the Windows HTML clipboard
format to -1.  See
http://www.peterbuettner.de/develop/javasnippets/clipHtml/index.html

If I use the Clipview app on that page and manually modify the StartHTML and
EndHTML properties of the text/html copied from Java, I am able to paste it into
OpenOffice Writer.
Comment 7 fredriv 2006-01-31 06:52:38 UTC
I have submitted a patch to Sun's Java bug database to fix the issue with
pasting text/html from Java into Writer and Calc in Windows, please see
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6304958

Hovewer this should probably be possible to fix in OpenOffice as well, with a
workaround handling StartHTML and EndHTML values of -1 in the Windows HTML
clipboard format - in that case, set them to the value of StartFragment and
EndFragment perhaps?
Comment 8 phaphe 2007-11-15 15:39:04 UTC
Is there any change to fix this problem in future?
Comment 9 damjan 2016-10-20 15:52:33 UTC
I can paste just fine from a JTable nowdays with Java 8. Must have been just an issue with StartHTML and EndHTML values being -1, which AOO also supports now as of #83004. Resolving duplicate.

*** This issue has been marked as a duplicate of issue 83004 ***