This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a simple class that takes a string and puts it on the clipboard...
My ultimate goal is just to format the string in the clipboard so that it pastes into MS Word as bold. How can I modify the code to do this?
Note: I'm working in Lotus Notes with the lotus.domino package, so I do have a RichTextItem class. I can get a MIMEEntity from my RichTextItem, which I believe allows me to create a new DataFlavor, which I'm guessing I'll need in creating a Transferable object that I can pass to the setContents method. This is where I'm stuck. I'm not sure how to connect these dots -- or even whether I'm headed in the right direction. [ September 14, 2005: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Sorry, I can't tell you how to do it. But here's an idea: To see what is put on the clipboard, create the desired text in Word/?? and copy it to the clipboard and then have a java program with lots of println()s look at what is in the clipboard. That should show you what you need to put there.
Joined: Aug 10, 2005
There is sample code for putting something on a clipboard in "Core Java, Volume II" by Horstmann and Cornell. You can also probably find samples by using Google.
Originally posted by Norm Radder: There is sample code for putting something on a clipboard in "Core Java, Volume II" by Horstmann and Cornell...
Thanks! I'll check that tonight. Those are great books -- although I haven't read the Swing chapter yet, which is where I'm guessing this is.
(Note: I tried looking at clipboard contents using Java code, but I'm stuck on how to work with the Transferable object. I think I need to downcast it to something based on an appropriate DataFlavor, but I don't know exactly what. This seems to be the same roadblock I hit approaching the problem from the other direction.) [ September 15, 2005: Message edited by: marc weber ]