• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Rich Text (formatted) in Clipboard?

 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Norm Radder
Ranch Hand
Posts: 728
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Norm Radder
Ranch Hand
Posts: 728
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic