How to insert hyperlinks in RTF document shown in JEditorPane?

This is a compound question so bear with me on this one :)
What I need is to insert an hyperlink in a JEditorPane; Store it as RTF code; Retrieve it; Show it and click on it to go the the destination.
1) So, first question, is there some method to automatically add the hyperlink and will it be saved in RTF with RTFEditorKit? (I'm actually using AdvancedRTFEditorKit but an answer to either will be enough)
2) I tried a method that adds what appears as a link but the document that is stored doesn't have the necessary RTF codes, only the formatting that makes it look like a link. I also checked the actual RTF codes I'd need to add and they seem easy to do. So, is there a way to add the actual underlying RTF codes to the document while it's in the JEditorPane?
I know the question(s) isn't too specific, if you can shed some light over the whole thing and point me in the right direction, it'd be great!

Just a follow up to my own question. I found a way to answer my question 2) and I'm now storing the rtf code for hyperlinks. Now, when I show the document in JEditorPane with RTFEditorKit, I get the name of the hyperlink with no formatting indicating that it's a hyperlink.
Example. The link "http://www.google.com" with the name "Google", only shows "Google" in plain text.
Is it because the components I'm using don't support hyperlinks from RTF files even though they're supported from HTML files?
Is there any way you can see this working? Is it possible to include something inside the JEditorPane that the user can click, instead of the hyperlink?

Similar Messages

  • Insert hyperlinks in pdf-documents

    Since Mavericks you can´t insert hyperlinks in pdf-documents. I miss this option in the preview. Are there any other possibilities?
    (I have MS Office for apple, therefore the links get lost, if I convert it to pdf).

    No one here can guess what "Apple wants." This is just an end user forum. There are open source alternatives to Pages and Office you may want to research: https://discussions.apple.com/docs/DOC-6941
    http://www.apple.com/feedback is where you can put your two cents if you so desire to get Apple to consider them.

  • How do you hyperlink one Pages document to another Pages document?

    How do you hyperlink one Pages document to another Pages document?

    Feature removed from Pages 5, along with over 90 others, by Apple.
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&sid=3527487677f0c 6fa05b6297cd00f8eb9&mforum=iworktipsntrick
    Pages '09 should still be in your Applications/iWork folder.
    Archive/trash Pages 5, after Exporting your files to Pages '09, and rate/review it in the App Store, then get back to work.
    Peter

  • How to set data in rtf document?

    Hi friends,
    I have a rtf document can anyone suggest how to set data in cells of an rtf document?Is there any way?
    Thanks in advance..
    Regards ,
    Soumyanil

    Convert the resultSet from the db to a Object[][], let's call it result.
    Then create a JTable (jTable1).
    On the JTable you need to define the headers, and the data itself.
    You can get the headers from ResultSetMetaData. Convert these to an array again (headers).
    Now use these methods to create a model and set the model of the JTable.
    Model model =  new DefaultTableModel(result, headers);
    jTable1.setModel(model);That's about the basics.
    If you need more info, use at the tutorial at sun's homepage.
    How to use Tables:
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

  • How to insert list or library documents to custom db

    Hi All,
    I have small requirement how to insert the list or library documents to Custom Database using server object model.
    Thank,
    Raj

    Hi,
    According to your description, my understanding is that you want to insert some list items to a custom database using Server Object Model.
    I suggest you can read some list field value you want using SPList and
    SPListItem Object, then you can use SqlConnection and
    SqlCommand object insert value to your custom database.
    Here are some detailed code demos for your reference:
    How to: Read the Value of a Field in a List Item
    Beginners guide to accessing SQL Server through C#
    Thanks
    Best Regards,
    Jerry Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to construct checkbox in rtf document using iText?

    Hi fiends
    I am developing a rtf document usng iText api ,I am facing problem when i want to draw a check box in the document so is there any way using iText only to draw a checkbox in rtf document?Or iText doesn't allow construct checkbox?please suggest.An example will be appreciated.Thanks in advance.
    Regards soumyanil

    For your kind information this is a site that provides support for JAVA programming and JAVA Servlets related questions.
    You need some information regarding a third party API, so please dont hesitate to contact your vendor.
    The vendor URL: http://itextdocs.lowagie.com/
    The tutorial you need to learn before starting iText is http://itextdocs.lowagie.com/tutorial/
    All the best!

  • Inserting Hyperlinks in Pages Documents

    I am writing a document in Pages with the intent of posting it at blogsite where I have editing privileges. I cannot, however, figure out how to highlight a portion of the text and link that text to a URL address. Can this be done with Pages?

    Here is what is occurring when I attempt to insert a hyperlink in a Pages document:
    1. When I click on the Inspector button and check the hyperlink box the following URL address appears (as though it were a default) http://livepage.apple.com/
    2. This URL address will also appear in the Pages document that I am working on. I then have to return to the document and remove this URL address before continuing.
    3. If I delete this particular URL address from the Link Box and paste in the URL address I want, the highlighted text in the document appears with a rectangular shaped box around the words I want hyperlinked but there is no link established.
    4. These events are all quite puzzling because I had assumed that inserting a hyperlink was a fairly easy process. I looked in the Pages' Help section to verify my understanding before I even made my initial attempt to insert a hyperlink. After continually failing to do so, I posted a message that Dennis was kind enough to respond to but I am still pretty much stuck.

  • How to insert page numbers in document

    How can I insert page numbers using Pages starting with the second page of the document?

    click where you want the numbers > Menu > Insert > Page Numbers
    At the end of the first page:
    Menu > Insert > Section Break
    Click in the 2nd page:
    Inspector > Layout > Section > Start at: 1 > uncheck Use previous headers and footers
    Peter

  • Need tutorial on how to insert charts in Pages document

    Can someone tell me where to find a tutorial on how to create a chart within a Pages document?

    Pages (dropdown menu)>insert>chart
    if you enter "char"t into the pages help menu,  you will find tutorials.

  • How to insert emoji characters into document?

    I paid for and downloaded emoji but I cannot insert the pictures into my pages document. How do I insert emoji characters into my pages document?

    Shelborne wrote:
    I paid for and downloaded emoji
    Why would you do that?  Just use Character Viewer to input Apple's built in emoji.
    OS X Yosemite: Use the Character Viewer
    Pages 09 does not support color emoji, use Pages 5 instead.

  • How to insert HTML content directly in code from JEditorPane ?

    I'm developping an HTML Editor on a JEditor Pane.
    The problem is that a blank is not interpreted, and i've tried to add "& n b s p ;" in the code from a KeyListener added to the VK_SPACE event, or to define an Action to add HTML Spaces. But i didn't achieve to...
    I just want to insert a "& n b s p ;" in the HTML code of the document displayed in the JEditor evry time the SpaceBar is pressed.
    I've tried InsertContentAction() :
    Not a solution :It inserts " & n b s p ;" in the text (it appears litteraly).
    I've tried InsertHTML. But it needs a tag parameter, and in my case, i need no tag
    to be inserted.
    I'm stuck since days... Any help woul be extremely appreciated...

    The code I now have is:
    TextAction actInsertNBSP = new TextAction("insert-space"){    
    public void actionPerformed(ActionEvent evt){
    //Where is the cursor now
    int intInitialCaretPos = text.getCaretPosition();
    try{       
         //Make HTML document to add the html code
         HTMLDocument htmldoc = (HTMLDocument)text.getStyledDocument();
         //Get document input attributes before insert
         AttributeSet atr = kit.getInputAttributes().copyAttributes();
         //Insert tag
         kit.insertHTML(htmldoc,intInitialCaretPos,"<b>\240</b>", 0, 0, HTML.Tag.B);
         //Set stored attributes to input attributes
         kit.getInputAttributes().addAttributes(atr);
         //Set cursor on right position
         text.setCaretPosition(text.getCaretPosition());                    
         }catch (Exception exc){
              exc.printStackTrace();
    KeyStroke kstSpace = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0);
    text.getKeymap().addActionForKeyStroke(kstSpace,actInsertNBSP);

  • How to insert a word document or an RTF document into RichTextEditor?

    How to insert a word document or an RTF document into af:richTextEditor. I am using Apache POI for reading the Word document and getting its contents. I am able to display the whole content of the document except the table and image within the document. The data in the table is getting displayed as a string and not as a table inside the editor.
    Can we insert a word/RTF document into a rich text editor?
    Can we insert images into the rich text editor?
    The following is the code that I used. On clicking a button the word document has to be inserted into the <af:richTextEditor>.
    <af:richTextEditor id="rte1" autoSubmit="true"
    immediate="true"
    columns="110" rows="20">
    <af:dropTarget dropListener="#{SendEmail.richTextEditorDrop}">
    <af:dataFlavor flavorClass="java.lang.String"/>
    </af:dropTarget>
    </af:richTextEditor>
    <af:commandButton text="Insert at position" id="cb2">
    <af:richTextEditorInsertBehavior for="rte1" value="#{RichTextEditorUtil.docFile}"/>
    </af:commandButton>
    Java Code: I am using Apache POI for reading the word document.
    import org.apache.poi.hwpf.HWPFDocument;
    import org.apache.poi.hwpf.extractor.WordExtractor;
    public String getDocFile() {
    File docFile = null;
    WordExtractor docExtractor = null ;
    WordExtractor exprExtractor = null ;
    try {
    docFile = new File("C:/temp/test.doc");
    //A FileInputStream obtains input bytes from a file.
    FileInputStream fis=new FileInputStream(docFile.getAbsolutePath());
    //A HWPFDocument used to read document file from FileInputStream
    HWPFDocument doc=new HWPFDocument(fis);
    docExtractor = new WordExtractor(doc);
    catch(Exception exep)
    System.out.println(exep.getMessage());
    //This Array stores each line from the document file.
    String [] docArray = docExtractor.getParagraphText();
    String fileContent = "";
    for(int i=0;i<docArray.length;i++)
    if(docArray[i] != null)
    System.out.println("Line "+ i +" : " + docArray);
    fileContent += docArray[i] + "\n";
    System.out.println(fileContent);
    return fileContent;

    Hi,
    images are not yet supported. Its an open enhancement request for the rich text editor.
    For tables, it seems they are supported but in a basic way (just HTML 4 style) if I interpret the tag documentation correct
    http://download.oracle.com/docs/cd/E15523_01/apirefs.1111/e12419/tagdoc/af_richTextEditor.html
    Frank

  • How do you HYPERLINK a web page address to an EXCEL document in Firefox like is possible in Explorer

    How do you HYPERLINK a web page address to an EXCEL document in Firefox like is possible in Explorer?

    When you follow a hyperlink in Excel, usually it should open in your default browser. You shouldn't have to do anything special in Excel to create the link when Firefox is your default browser compared with IE. However, the Insert Hyperlink dialog might work differently. I think it might be able to automatically pre-populate a URL from IE, while in Firefox, you need to copy the URL from Firefox's address bar and paste it into the Insert Link dialog.

  • How to insert a HYPERLINK in a template Editable Field?

    Question:  How to insert a HYPERLINK in a template Editable Field?
    Hi
    Does anyone know how to insert a HYPERLINK in a template Editable Field?
    I want the link to always display the word "Cities".
    But the URL will change with each child page.
    Here's what I've got so far . . .
    <!-- TemplateBeginEditable name="Cities" -->Cities<!-- TemplateEndEditable -->
    Thanks so much!

    NOTE: This is to go into the TEMPLATE
    Your best bet is to keep the hyperlink OUT of the editable Field and to make the HREF attribute of the link editable.
    This would go in the head of your document:
    <!-- TemplateParam name="href" type="URL" value="" -->
    This would go where you want the link to appear:
    <a href="@@(href)@@">cities</a>
    THE BETTER WAY: You can either paste these quotes into the appropriate places in your template or you can insert:
    <a href="#">cities</a>
    and click inside the opening <a> tag.
    Then go to Modify > Templates > Make Attribute Editable
    In the dialog box "Editable Tag Attributes" you should now see "Choose which attributes of this A tag should be editable."
    If HREF is not showing in the drop-down, do Add and put it there.
    Check the box to Make this attribute editable.
    Give a name for this editable attribute (if you have more than one on a page, you will want it to be understandable, like "cities" for your cities links).
    Make sure it is of Type URL
    If you want a default URL in place, put one in the Default field.
    Then push OK.
    To use it, on each page, do Modify > Template Properties... choose the property to edit, and put the new URL in the entry field.
    Press OK.
    Beth

  • How can I convert a Pages document into PDF or RTF?

    I have been asked to send a Pages document to PC users in RTF or PDF format.  How can I get my Pages document to convert into other formats for PC people?
    Is that what the export feature is supposed to do?  I just don't know how to sent my document via e-mail to non-Apple conputers!

    You didn’t indicate whether you are using Pages ’09 v4.+ or the latest Pages v5(.2) release. To send an email with either Word or PDF attachment from within Pages:
    Pages ’09 v4+
    Pages menubar > Share (category Send via Mail) > (select Word (.doc) or PDF). Mail will launch into a compose window with the document already attached.
    Pages v5+
    Pages toolbar > Share > Send a Copy > Email > (select Word (.doc/x) or PDF - best). Mail will behave as above.
    Note: Either version of Pages is not an MS Word clone and it must translate content into the Microsoft document architecture. If you must have maximum Word document accuracy, you will need Office for Mac 2011, and the associated MS Word application that produces native .docx format.
    Backup your work.

Maybe you are looking for

  • Safari crashes on launch. Help!

    Please help! My Safari crashes on each launch. I can't re-install it, as I'm on OS X 10.7 and there's now install file for Safari by itself. I recently even re-installed the whole OS X Lion, which didn't help either. Here's the error log: Process:   

  • Print file deletes before print job is finished

    I have been trying to print a file about 119 pages it has some color graphics and some photos within the text from adobe it printed about 25 pages good then it stopped and deleted the file I have tried to print 1 page at a time some print and some ju

  • How do i get my computer to recognize my iphone and download itunes?

    When i plug my iphone up to my laptop it recognizes it but never pulls up itunes and when i take it to the other computer that has itunes already on it that itunes does not recognize it. what do i do?

  • How to set/get the archive file attribute?

    I am programing a (freeware!) ftp client and need to know, how to set/get the archive attribute of a local file. I was searching through whole the i-net - nothing at all! please help me!!

  • BW-BASIS communication

    Dear All,          I am a new BW guy.My team is about to enter their first SAP Implementation project. What are the prerequistes I have to provide the BASIS guy with on BW? for e.g type of filesystem, SAN , partitioning of space , job allocation etc.