title: Copy RichText (Formatted) To clipboard Java
body: <p>Using the following code to copy a flat string to (windows) System Clipboard:</p>
  
  <pre><code>StringSelection selection = new StringSelection(string);
      Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
      clipboard.setContents(selection, selection); 
  </code></pre>
  
  <p>However this will only copy the text, Is there a why a string can be copied to the clipboard with formatting(RTF), so when pasted into another program e.g MS Word, the formatting is picked up? </p>
  
  <p>(By formatting I mean for instance font, font size)</p>
  
  <p>For example, I wish to copy the String : "Summary: Move waypoints to the left" in font size 12 Arial Font to the clipboard</p>