CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Html

  1. #1
    Join Date
    Aug 2004
    Posts
    147

    Question Html

    Hi everyone,

    I am trying to add html tables to a html document and the html table appears but here is the problem in that only certain attributes of the table is being adhered to and the rest ignored. This is what i am doing

    Code:
    String table = "<table width="80%" height="80%" cellspacing="200" cellpadding="10" border="20" bordercolor="#ff0033" bgcolor="#33ff33">
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    </table>";
    
    Element ele = doc.getParagraphElement(Pane1.getCaretPosition());
    
    try
    {
    doc.insertAfterEnd(ele, table);
    }
    
    catch(Exception e)
    {
    e.printStackTrace();
    }
    Please note that Pane1 is an instance of the JTextPane class and doc is an instance of the HTMLDocument class which uses the default HTMLEditorKit class.

    The table appears in the document but only cell padding, background color and table width options if varied produces the appropriate changes to the table that is being inserted.

    The rest of the options such as borderwidth, bordercolor cell spacing and table height don't have any differences even when they are varied. They always remain the same.

    Basically i need to know if i am inserting the html table correctly into the HTMLDocument or is there something that i need to do which i am not doing in the above code.

    I am using the java sdk 1.4.2

    Any help is greatly appreciated

    Thank You

    Yours Sincerely

    Richard West
    Last edited by freesoft_2000; July 6th, 2005 at 01:06 PM.

  2. #2
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: Html

    Without looking into your problem in detail, java supports HTML 3.2, not HTML 4.0. Would that be to any help?

    - petter

  3. #3
    Join Date
    Jun 2005
    Posts
    33

    Thumbs up Re: Html

    The problem is with the String variable table.

    U haven't used escape sequences for double quotes.

    So the string variable might be truncated.

    This is just a guess.

    Try doing this.

  4. #4
    Join Date
    Aug 2004
    Posts
    147

    Re: Html

    Hi everyone,

    Sorry i forgot the escape characters, here is the new value for the string variable

    Code:
    String table = "<table width=\"80%\" height=\"80%\" cellspacing=\"200\" 
                       cellpadding=\"10\" border=\"20\" bordercolor=\"#ff0033\" 
                       bgcolor=\"#33ff33\"><tr><td>&nbsp;</td><td>&nbsp;
                       </td></tr><tr><td>&nbsp;</td><td>&nbsp;
                       </td></tr><tr><td>&nbsp;
                       </td><td>&nbsp;</td></tr></table>";
    The thing is i am still getting the same results as posted in my first post and have no idea why this is so and am open to any suggestions

    Any help is greatly appreciated

    Thank You

    Yours Sincerely

    Richard West

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured