Apache OpenOffice (AOO) Bugzilla – Issue 51267
cannot copy data from custom java jtable via clipboard
Last modified: 2016-10-20 17:59:12 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...
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
TM->requirements: Please have a look. This is not a defect but might be a wish for an enhancement.
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 ?
A useful link: http://www.javaworld.com/javaworld/javatips/jw-javatip77.html
Sun updated bug 6304958 with an interesting evaluation: see link above, section "Evaluation"
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.
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?
Is there any change to fix this problem in future?
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 ***