Hello, I have an application that interacts with a database in MySQL and want to know, how I can store the code that generates the JEditorPane. I have the following:
And when I do a:
returns me null.
And if I do a:
back what I have written to the editor, but in plain text without the <br> \ par, etc ...
I have read in many forums and I see that you use the RTFEditorKit, but only used to read or write files .rtf and I need to store the code that generates the editor to save it in a DB.
Any ideas or suggestions?
Thank you very much.
Edited by: 892291 on 17-may-2012 12:29
I need is to store the text in RTF format is in JEditorPane.
Plain Text Example:
Hello, this is a test
RTF Text Example:
"\\viewkind4\\uc1\\pard\\lang3082\\ul\\b\\f0\\Hello, this \\par \\ulnone\\b0 is a test. LH: 25 / FSH: 69 / Est: 20"
I need to capture the format of the second case.
Maybe I have not explained very well
The problem is that i was looking at the methods that have the RTFKitEditor, and I have not managed to find which is the method that returns the text as I want. Only returns the content of the JEditorPane. Moreover, in the forums only explain how to read and write files .rtf
Thank's! Problem solved.
But with the StringWriter gave me an error: RTF is an 8-bit format. So I used ByteArrayOutputStream.
I put the example:
ByteArrayOutputStream str = new ByteArrayOutputStream();
kitrtf.write(str, JEditorPane1.getDocument(), 0, JEditorPane1.getDocument().getLength());