I figured out how, in code, to add color and fonts to my JTextPane. But when I copied the text to a Microsoft Word document it only copied the text, not the formatting. Is it possible to copy from a JTextPane to a Microsoft Word document or Outlook email with the colors and fonts preserved? If so, how can this be accomplished?
I don't see why not. You would have to go through the styled document and convert all of the text and styles that it contains to text and styles in MS Word format. There's an API from Apache POI which supports Word.
I got it to work using the RTFEditorKit. I had to define my own copy to clipboard method. Right now I have a button click event that calls this code. If I want to implement Ctrl-C, Ctrl-V I'll have to override those keystrokes to call this code. By default it just copies text.