wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes paste text from Word into html editor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "paste text from Word into html editor" Watch "paste text from Word into html editor" New topic
Author

paste text from Word into html editor

Krsta Jovanovic
Greenhorn

Joined: Feb 03, 2004
Posts: 1
How can I enable pasting in html editor to work with text taken from a Word document?
Eddie Vanda
Ranch Hand

Joined: Mar 18, 2003
Posts: 281
JTextComponent has copy, cut and paste methods. You can call them with ctl X, C and V keys or you can add a popup menue and call them in your program. That would apply to all derived classes such as JTextField and JTextArea. Not sure about the HTML classes, though!


The nice thing about Standards is that there are so many to choose from!
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Welcome to the Ranch Krsta,
In this Tutorial you can see that JEditorPane supports the paste action.
I have been able to paste text from Notepad to a JEditorPane displaying an html file; but it did not work with "text" copied from Word.
[ February 06, 2004: Message edited by: Jose Botella ]

SCJP2. Please Indent your code using UBB Code
Eddie Vanda
Ranch Hand

Joined: Mar 18, 2003
Posts: 281
I have clients who copy from Word to my app's JTextArea ok. Word does use non-UTF-8 characters that show up as little squares, but you could translate them.
 
GeeCON Prague 2014
 
subject: paste text from Word into html editor