Results 1 to 3 of 3
  1. #1
    Smig is offline Banned
    Join Date
    Jan 2012
    Posts
    1
    Rep Power
    0

    Default How to get the rtf data from a JEditorPane (text/rtf) to store it in a database

    I want to store the content of a JEditorPane with rtf data into the database so that I can retrieve it again and show it on the JEditorPane exactly as it was first created. For this, I need the actual rtf data, not just the text.

    If I use jEditorPane1.getText(), I get null.

    Eventually, I found jEditorPane1.getStyledDocument().getText(0,jEditor Pane1.getStyledDocument().getLength()) which returns the text, but without any formatting.

    I'd need the text with the rtf formatting codes so that I keep the formatting.

    Any ideas?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,240
    Rep Power
    19

    Default Re: How to get the rtf data from a JEditorPane (text/rtf) to store it in a database

    Read the API for RTFEditorKit

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,240
    Rep Power
    19

    Default Re: How to get the rtf data from a JEditorPane (text/rtf) to store it in a database

    Moved from New to Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. JEditorPane text disappears
    By pbrockway2 in forum AWT / Swing
    Replies: 4
    Last Post: 05-26-2012, 11:09 AM
  2. read text data and store to array
    By Ericyue in forum New To Java
    Replies: 3
    Last Post: 04-09-2012, 02:07 PM
  3. Replies: 1
    Last Post: 05-16-2011, 01:19 PM
  4. Replies: 4
    Last Post: 04-10-2009, 05:35 AM
  5. Replies: 0
    Last Post: 02-06-2008, 03:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •