Insert HTML table into JTextPane

hi people!
I'm inserting htmltable in JTtextPane.
The problem is, that borders aren't shown.
they are shown in browser, the code in source view is also valid, but in JTextPane they ar invisible. Can anyone tell me Why?
Here is a piece of code:
public class HtmlTable {
public static String insertTableString(int rows, int columns) {
String tableString="<TABLE Width=100% Border=1>";
for (int i=0; i<rows; i++) {
tableString+="<TR>";
for (int j=0; j<columns; j++)
tableString+="<TD> </TD>";
tableString+="</TR>";
tableString+="</TABLE>";
return tableString;
call of this method:
HTMLEditorKit kit;
HTMLDoc=(HTMLDocument)editorTextPane.getStyledDocument();
kit=(HTMLEditorKit)editorTextPane.getEditorKit();
kit.insertHTML(HTMLDoc,editorTextPane.getCaretPosition(),HtmlTable.insertTableString(HtmlTable.getRowNumber(), HtmlTable.getColumnNumber()),0,0,HTML.Tag.TABLE);

no Java code involved, just HTML and CSS
<HTML>
<HEAD>
<style type="text/css">
td {border-top-width:1pt; border-style:solid; }
</style>
</HEAD>
<BODY>
<p>
Your Table goes here
</p>
<table>
<tr>
<td><p>Row 1 Col 1</p></td>
<td><p>Row 1 Col 2</p></td>
</tr>
<tr>
<td><p>Row 2 Col 1</p></td>
<td><p>Row 2 Col 2</p></td>
</tr>
</table>
</BODY>
</HTML>

Similar Messages

  • How to insert a table in JTextPane("text/html")....

    How to insert a table in JTextPane(with contentType(text/html))....like we insert bold/italics etc..AND when I retrieve the contents using getText(),I should be able to get the html tags for table.........!!!
    Anyone Anywhere with solution..???

    -------

  • How to insert html table tag in flash.

              i am trying to insert my html table format into flash... but flash doesn't support that html table tags....
    i'm creating a filp book for help manual..  In that we use flash  and html tags... His there any other way to insert html table in to flash...
    give ur suggestions..
    thanks.

    As you say, Flash does not support html table tags.  Create your own tables using textfields and if you need borders around cells use either textfield borders or lines surrounding the textfields.

  • Insert internal table into datbase table

    Hi,
    I want to insert internal table into database table.
    i have use following code
    loop at it_header.
      INSERT ZTAB from table it_header accepting duplicate keys.
    endloop.
    but above code insert only first line  not multipal.
    Thanks in Advance.
    Sam

    Hi SAM,
    Creating a SingleRecord -
    >>>>
    INSERT INSERT INTO <dbtab> VALUES <wa>.
    Eg. DATAwa_spfliTYPEspfli.
    wa_spfli-carrid = 'LH'.
    wa_spfli-connid = '0007'.
    wa_spfli-cityto = 'SINGAPORE'.
    INSERT INTO spfli VALUES wa_spfli.
    Fsy-subrc NE 0.
    Creating Several Records---->>>>
    INSERT <dbtab> FROM TABLE <itab>.
    Eg.
    DATA:it_spfli TYPE STANDARD TABLE OF spfli,
    wa_itab LIKE LINE OF it_spfli.
    wa_itab-carrid= 'LH'.
    wa_itab-connid= '0009'.
    wa_itab-cityto= 'HONGKONG'.
    APPEND     wa_itab TO it_spfli.
    APPEND     wa_itab TO it_spfli.
    INSERT spfli FROM TABLE it_spfli.
    IFsy-subrc NE 0.

  • Outlook 2013 - Insert HTML code into email

    Hi there,
    A simple question, or so I thought. How can I insert HTML code into an Outlook email?
    Thanks
    Dave

    You can inject HTML code into the message body via the Insert as Text option;
    Insert-> (Attach) File-> select the created htm-file-> press the down arrow on the Insert button-> Insert as Text
    Cheers,
    Tony Chen
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please contact
    [email protected]

  • I need to insert a table into my form.  Anyone know how to do this?

    I'm trying to figure out how to insert a table into my current form.  I can't seem to locate any button or instruction on how to do that.  Any and all help is greatly appreciated. 

    I'm guessing you're using the free version. I would first try to import a table from another PDF file. If that doesn't work I would try using the "add item" feature for either the "text" or "email" fields because those are formatted as 2 columns. You will just have to manipulate them how you want them.
    Good luck!

  • Best way to insert a table into image with high resolution for web?

    I've tried inserting a table from Excel into Photoshop and making a jpeg and gif out of it, but when I upload it to the web the resolution is terrible.
    Any ideas on how I can make get a table into an image? It's a bit too complex to create with HTML.

    Well, you are leaving out a lot of info.
    a: how are you saving it in Photoshop? What file type/compression amount, etc.
    b: how are you uplaoding it - where are you uploading it - are you uploading JUST the image, or are you uploading the image within an .html document?
    One thought, if you are JUST uploading it as an image, then trying to view it in a browser, if the image is larger than the viewport of the browser, some browsers will automatically rezie the image to fit visually into the viewport. More than likely, this resizing could be causing image distortion. Imagine it like when you zoom in/out in Photoshop - (unless you are using the accelerated graphic gui option in PS preferences), any zoom level outside of 25%, 50%, or 100% will cause visual distortion.
    Give a link to where you have uploaded the image (or whatever you are talking about). Like I said, there are other things to consider as to why this is happening.

  • Inserting HTML content into an animated DIV

    Can you, and if so how, insert HTLM content into an EGDE animated Div box? Specificaly an HTML table?  I can get the html code in the box but it won't read/render it as html code. In flash you can tell the program that the contents of the box is html code and it will read it as such but I don't see any way to do that here. I've tried several ways and I can get the code to display in the box but it won't render the code instruction in the boxCan it be done ??
    Thanks
    joel

    Hi,
    1) Your json file is not valid.
    You can copy and paste your datas here: http://jsonlint.com/
    Red commas must be deleted.
          "player": [
                "image": "images/player1.jpg",  //this is the URL I want to retrive
               "name": "player1",
                "image": "images/player2.jpg",
                "name": "player2", 
                "image": "images/player3.jpg",
                "name": "player3", 
                "image": "images/player4.jpg",
                "name": "player4",
    2)An example from http://docs.jquery.com/Ajax/jQuery.getJSON:
    3) compositionReady Tests.
    On compositionReady, i write:
    var profiles = {
                   "player": [
                        "image": "images/player1.jpg",
                        "name": "player1",
                         "image": "images/player2.jpg",
                         "name": "player2", 
                         "image": "images/player3.jpg",
                         "name": "player3", 
                         "image": "images/player4.jpg",
                         "name": "player4",
    console.log(profiles.player[1].image); // this line returns: "images/player2.jpg"
    Note: i deleted the first "[" and the last "]".

  • Insertion of icons into JTextPane

    Hello!
    I am trying to insert icons into JTextPane object, and I got a problem.
    My partial code is as follows...
    StyleConstants.setIcon(s, icnIcons);
    doc.insertString(doc.getLength(), "I", doc.getStyle("icon"));
    doc.insertString(doc.getLength(), "I", doc.getStyle("icon"));
    In the above code, s is an object of Style, and icnIcons is an object of ImageIcon, and doc is an object of StyledDocument.
    And the style, s, is registered with a name, "icon".
    If I execute the above code, then only one icon is displayed. But the length of the text is increased by 2.(I check this using doc.getLength() method.)
    So, I make a little change to the above code like the following:
    StyleConstants.setIcon(s, icnIcons);
    doc.insertString(doc.getLength(), "I\n", doc.getStyle("icon")); //changed
    doc.insertString(doc.getLength(), "I", doc.getStyle("icon"));
    I just add "\n". And the second code is working, and displays two icons.
    But the two icons are on the separate line.
    And if I use two different icons, that is, two different styles, in the first code segment, then it works and shows the two icons on the same line, though I didn't use the "\n".
    Why does this happen?
    I am so confused. Please help me.
    Thanks for every body!
    Regards

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    import javax.swing.text.*;
    public class IconPane {
        private void showTest(BufferedImage[] images) throws IOException {
            JTextPane textPane = new JTextPane();
            // Add some content.
            File file = new File("IconPane.java");
            BufferedReader br = new BufferedReader(
                                new InputStreamReader(
                                new FileInputStream(file)));
            textPane.read(br, file);
            br.close();
            // Make up a couple of styles.
            int pos1 = 875, pos2 = 876;
            StyledDocument doc = textPane.getStyledDocument();
            Style style = textPane.addStyle("icon1", null);
            StyleConstants.setIcon(style, new ImageIcon(images[0]));
            // Set  icons.
            doc.setCharacterAttributes(pos1, 1, style, false);
            style = textPane.addStyle("icon2", null);
            StyleConstants.setIcon(style, new ImageIcon(images[1]));
            doc.setCharacterAttributes(pos2, 1, style, false);
            // Add the icons again with the insertString method.
            addContent(doc);
            // Show me.
            JScrollPane scrollPane = new JScrollPane(textPane);
            scrollPane.setPreferredSize(new Dimension(500,400));
            textPane.addMouseMotionListener(mouseInput);
            JOptionPane.showMessageDialog(null, scrollPane, "",
                                          JOptionPane.PLAIN_MESSAGE);
        private void addContent(StyledDocument doc) {
            int pos1 = 1667, pos2 = 1669;
            try {
                // Try inserting icons with insertString.
                doc.insertString(pos1, " ", doc.getStyle("icon1"));
                doc.insertString(pos2, " ", doc.getStyle("icon2"));
            } catch(BadLocationException e) {
                System.out.printf("bad location error: %s%n", e.getMessage());
        public static void main(String[] args) throws IOException {
            String[] ids = { "--g--", "---h-" };
            BufferedImage[] images = new BufferedImage[ids.length];
            for(int j = 0; j < images.length; j++)
                images[j] = ImageIO.read(new File("images/geek" + ids[j] + ".gif"));
            new IconPane().showTest(images);
        private MouseMotionAdapter mouseInput = new MouseMotionAdapter() {
            public void mouseMoved(MouseEvent e) {
                int pos = ((JTextComponent)e.getSource()).viewToModel(e.getPoint());
                System.out.println(String.valueOf(pos));
    }

  • Inserting html pages into dw

    I've put together a page of 18 thumbnails that are rollovers
    in Image Ready -
    they click to bring up large images on the same page. The
    large images are
    layered on top of each other.
    How can I insert this page into a dw page that already
    contains some content?

    8)
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "crash" <[email protected]> wrote in message
    news:elmiq4$sq1$[email protected]..
    > that is far, far too early to be posting on the boards.
    >
    > :O)
    >
    > "Murray *ACE*" <[email protected]>
    wrote in message
    > news:elm485$boe$[email protected]..
    >>> design each page fully in IR and then link them
    in DW?
    >>
    >> Good grief no.
    >>
    >>> Or perhaps use framesets rather than tables
    only?
    >>
    >> GOOD GRIEF Noooooo!
    >>
    >> Just upload your page and post a link to it, please.
    >>
    >> --
    >> Murray --- ICQ 71997575
    >> Adobe Community Expert
    >> (If you *MUST* email me, don't LAUGH when you do
    so!)
    >> ==================
    >>
    http://www.dreamweavermx-templates.com
    - Template Triage!
    >>
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    >>
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    >>
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    >> ==================
    >>
    >>
    >> "gypse" <[email protected]> wrote
    in message
    >> news:elld1i$f62$[email protected]..
    >>> Thanks for your reply - I tried it - ie pasting
    code into code section,
    >>> but for
    >>> some reason the page came up with all the links
    broken...perhaps it's
    >>> better to
    >>> design each page fully in IR and then link them
    in DW?
    >>>
    >>> Or perhaps use framesets rather than tables
    only?
    >>>
    >>> thanks
    >>> - Chrissie
    >>>
    >>
    >>
    >
    >

  • How to insert Glyphs symbol into JTextPane's document

    Hi all,
    I m creating an application in which i want to insert symbol of "Symbol", "Webdings", "Wingdings" etc's fonts into JtextPane's document. How can i do that? can nebody help me.
    Its urgent.
    Thanks in advance,
    Regards,
    Danish Shaikh.

    textPane().getDocument().insertString(...)

  • Can I include a Dynamic HTML Table into XML Forms?

    Hi,
    I have a requirement For XML Forms that I don´t know if possible, the requirement is that I can let the user create a HTML Table in a template generated by XML Forms, so he can include in the Content a HTML Table that is displayed with the elements he decided.
    Thanx in Advanced!
    Gerardo J

    Hi,
    To Create HTML Tables in the XML Forms, use the HTML Editor from the Menu and Function bar. When the form is generated then tables can be created using this editor.
    Thanks and Regards,
    Gauri Gosavi.

  • Insert Numbers Table Into Pages

    Is there an equivalent to the "Past-Special" command found in MS Word/Excel? I want to link a Numbers table into a Pages document and have the Pages document automatically change when the Numbers table is changed.

    Hi, I think there might be some misleading information about this.
    You can highlight a table in Numbers, copy, then paste it into your Pages document. It moves and resizes like an image, and you can directly edit any cell in the table. You can add rows, columns, etc the way you can if you create a table through Pages. The functions all remain the same and change automatically as you change the information.
    While you may not be able to link so that changes in one program affect the other, I find I don't need it to change in both very often. If it ever does become an issue, I just copy/paste whichever is "complete" into the other and continue.
    Hope it helps!
    (Incidentally, you can do the same thing to take tables created in Pages and put them into Numbers)
    Message was edited by: FredoSays

  • Insert HTML Page into XML CDATA Tag

    Hi Guy
    I have a very big problem.
    I create a little web site and I use XSL + XML to produce output.Now I
    want to add a part of html page into xml tag to use a custom page section.
    But i find a problme,
    see the example :
    I use this xml :
    <resources>
    <html><![CDATA[<B>Hello World</B>]]></html>
    </resources>
    trasform xml with xsl page
    and my output into html browser is (&lt);B(&gt);Hello World(&lt);/B(&gt);(please remove the bracket( ) while reading the text to understand my problem)
    my BOLD html tag is not parse by browser because xslt parser trasform
    my special tag into other tag.
    I want output like this:
    <b>Hello World</b>
    But it's coming like (&lt);B(&gt);Hello World(&lt);/B(&gt); (please remove the bracket( ) while reading the text to understand my problem)
    Can you help me ?
    this is my trasformation function :
    private Transformer getXSLTransformer (xslFile) throws
    XSLTransformerConfigurationException {
    try {
    Transformer transformer = null;
    tFactory = TransformerFactory.newInstance();
    transformer = tFactory.newTransformer(new
    StreamSource(xslFile)); // load xslFile from disk
    } catch (TransformerConfigurationException tce) {
    throw new XSLTransformerConfigurationException(tce.getMessage());
    return transformer;
    public String myTrasform(String xml,String xslFile) throws Exception {
    StringWriter outputString = new StringWriter(512);
    Transformer transformer = getXSLTransformer (xslFile);
    transformer.transform(new StreamSource(new StringReader(xml)), new
    StreamResult(outputString));
    return outputString.toString();
    Thank's in advance.
    kuruvi
    Edited by: Mc_Kuruvi on Jun 14, 2009 3:47 AM

    Read:
    Oracle® XML DB
    Developer's Guide
    10g Release 1 (10.1)
    Part No. B10790-01
    December 2003
    1. "Do I use sqlloader and what datatype?"
    Use XMLType
    2. "I have embedded graphics so do the images get stored separately or does the entire page get stored as a BLOB datatype?"
    Page 827:
    The Oracle XML DB native datatype XMLType helps store and manipulate XML. Multiple storage options (Character Large Object (CLOB) or structured XML) are available with XMLType, and administrators can choose a storage that meets their requirements. CLOB storage is an un-decomposed storage that is like an image of the original XML.

  • How to insert html table inside java code

    Hi,
    I want to send an email with data in table format(with rows and columns) .Please tell me how to achieve this in java code .I just want to know the code for making the table in java
    Please help me
    Thanks in advance

    NewUser7 wrote:
    Please tell me how to generate html tables in java. .. Do you know how to produce an HTML table in HTML?
    ..i dont have jspI did not mention JSP. Pure J2SE code can produce HTML, though if done in a web-app., it would generally be done using JSP or Servlets.
    Here is an example of producing HTML in J2SE.
    import javax.swing.*;
    class HtmlTable {
         public static void main(String[] args) {
              int[][] values = {
                   {1,3894,5387},
                   {2,4112,4459},
                   {3,4886,6076}
              String prefix = "<html><body><table>\n";
              final StringBuilder sb = new StringBuilder(prefix);
              sb.append("<tr>");
              sb.append("<th>");
              sb.append("Month");
              sb.append("</th>");
              sb.append("<th>");
              sb.append("Unit A<br>Sales");
              sb.append("</th>");
              sb.append("<th>");
              sb.append("Unit B<br>Sales");
              sb.append("</th>");
              sb.append("</tr>\n");
              for (int ii=0; ii<values.length; ii++) {
                   sb.append("<tr>");
                   for (int jj=0; jj<values[ii].length; jj++) {
                        sb.append("<td>");
                        sb.append("" + values[ii][jj]);
                        sb.append("</td>");
                   sb.append("</tr>\n");
              sb.append("</table>");
              sb.append("</body>");
              sb.append("</html>");
              Runnable r = new Runnable() {
                   public void run() {
                        JOptionPane.showMessageDialog(
                             null,
                             new JTextArea(sb.toString(),20,10) );
                        JOptionPane.showMessageDialog(
                             null,
                             new JLabel(sb.toString()) );
              SwingUtilities.invokeLater(r);
    As an aside, those terms are HTML (an abbreviation) Java (a proper name) & JSP (an abbreviation). Please try to use correct upper/lower case when using technical terms.

Maybe you are looking for

  • Stock value related to sales return

    Hi experts, When sales return, the return goods captures the current stock value after PGI. What's the system logic for that? U know, the customer wants it to capture the stock value of the responding sales delivery date. For e.g., the goods (10 ton)

  • Restrict PR/PO/GR for a particular company code from particular date

    Hi Experts How we can restrict PR/PO/GR for a particular company code from a particular date? I know PR is not directly linked with company code PO can be restricted by deactivating the assignment between company code & plant GR- we can use posting p

  • -Frustrated :  Multiple iPod Problems

    I've been attempting to fix several issues with my girlfriend's iPod (30Gb 5gen) which I gave to her for her birthday, with no success. #1 Files purchased from the iTunes store will not transfer directly into the iPod. When doing so an error message

  • How can I reorder pictures in slideshow that are brought in from Aperture?

    I am bringing in about 100 photos from Aperture. When I bring them in to iWeb they re-sort to be according to file name as opposed to the time the photo was taken (I am merging my photos with photos from a friend's camera taken of the same event, so

  • Getting error while Using BAPI Interface in VB

    Hi, I m getting error message while creating object of SAP.BAPI.1 Error message is "out of memory : run time error 7". do I need to install any patch to my local PC? If yes then from where could i get that patch. Plz help me out. Thanks & Regards, Sa