I'm using a JEditorPane to render HTML for the purposes of printing.
It works very well except I cannot render borders for tables. I
haven't been able to find any bugs in the Sun bug database related to
this issue and I'm wondering if I'm just doing something wrong. I've
tried using both styles (AKA border-width: 3px;) and just <table
border=3>.
A normal browser renders the tables correctly in both cases.
Thanks for any help/advice you can give.
>I'm using a JEditorPane to render HTML for the purposes of printing.
>It works very well except I cannot render borders for tables. I
>haven't been able to find any bugs in the Sun bug database related to
>this issue and I'm wondering if I'm just doing something wrong. I've
>tried using both styles (AKA border-width: 3px;) and just <table
>border=3>.
That HTML is not well-formed. Try this instead:
<html>
<body>
<table border='3'>
<tr>
<td>R1-C1</td>
<td>R1-C2</td>
</tr>
<tr>
<td>R2-C1</td>
<td>R2-C2</td>
</tr>
</table>
</body>
</html>
>A normal browser ..
What is 'a normal browser'? I am not sure what that
means 'in your neck o' the woods', but I feel quite
confident in saying that JEditorPane is no 'normal
browser - it is no kind of browser at all'. All it is
good for, is rendering simple, valid (well-formed)
HTML controlled by you.
>..renders the tables correctly in both cases.
At one time, 50% of the enormous code of IE
was said to be for correcting crappy HTML. I
would not be surprised if 20-40%+ of the code of
other major UAs is much the same. JEP has
none (or close enough to say as much) of that.
>Thanks for any help/advice you can give.
Validate, validate, validate. Then KISS.

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Jason Cavett - 09 Oct 2007 14:50 GMT
> >I'm using a JEditorPane to render HTML for the purposes of printing.
> >It works very well except I cannot render borders for tables. I
[quoted text clipped - 45 lines]
>
> Message posted viahttp://www.javakb.com
1. Not sure what HTML you're talking about? I didn't really post any
in my message other than the <table> tag and I wasn't going for well-
formed. I was just showing what I had tried. When I actually write
my application I use well-formed, full HTML (per your example).
2. Normal browser = IE, Firefox, Safari - the three I tested. Yes, I
realize a JEditorPane is not a browser but since I'm only concerned
about rendering HTML, it's all the same thing at the moment.
3. Okay...well...either way IE *does* render the table. JEP does
not. I'm wondering if this is an actual problem or if there is
something I completely missed (which, it doesn't appear I have since
all the other HTML renders correctly).
4. Not sure what you mean by validate. And, the HTML is as simple as
you can get - just one table.
Lew - 09 Oct 2007 15:14 GMT
> 4. Not sure what you mean by validate.
Presumably to submit the HTML to
<http://validator.w3.org/>

Signature
Lew
Andrew Thompson - 09 Oct 2007 15:22 GMT
>> >I'm using a JEditorPane to render HTML for the purposes of printing.
>> >It works very well except I cannot render borders for tables.
...
>1. Not sure what HTML you're talking about? I didn't really post any
>in my message other than the <table> tag ...
Yes that* - let's move on..
>3. Okay...well...either way IE *does* render the table. JEP does
>not. ...
Huhh.
I tried that exact HTML above, in a JEP using
Java 1.6. Here is a screenshot of the result.
<http://www.physci.org/test/screenshot/tableborderinjep.png>
That looks like a border to me. Are you seeing
something different on your system?
>4. Not sure what you mean by validate. ...
* I am relatively (narrowly) focused on validation
at the moment. ;-)

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Jason Cavett - 09 Oct 2007 22:59 GMT
> >> >I'm using a JEditorPane to render HTML for the purposes of printing.
> >> >It works very well except I cannot render borders for tables.
[quoted text clipped - 24 lines]
>
> Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200710/1
Well, I'm using Java 5 (forgot to mention that) so if it works on 6,
that won't help.
Either way, I think I'm not going to worry about it. The customer
likes how it looks as is.