This is not a bug, you are creating an object adding stuff to it then converting it to
a
String. It is going to give the same results each time you request the conversion to a
String unless you add or subtract other objects in between the requests. The way
around
it is to create a new Font object each time you are adding different objects the same
way
you are treating the TD objects. (Or do ECS elements have a clone() type of method? I
haven't used ECS in some time.)
John McNally
Dragor wrote:
>
> I'm using ECS v1.4.1 and I've come across a little problem. When
> I try and insert font tags inside TD tags I have the data for the TD tags
> repeating in each TD tag. Here's a code snippet to demonstrate what I
> mean.
>
> import org.apache.ecs.html.*;
> import java.io.*;
>
> public class Test {
>
> public static void main(String args[]) {
>
> Font f = new Font()
> .setFace("Times")
> .setSize("+2");
>
> Html p = new Html()
> .addElement(new Body()
> .addElement(new Table(1)
> .addElement(new TR()
> .addElement(new TD()
> .addElement(f
> .addElement(new B()
> .addElement("One"))))
> .addElement(new TD()
> .addElement(f
> .addElement("tw"))))));
>
> try {
> FileWriter fout = new FileWriter("out.html");
> String str = p.toString();
> fout.write(str, 0, str.length());
> fout.flush();
> fout.close();
> } catch(Exception e) { System.out.println(e); }
>
> } // end main()
> } // end Test
>
> The file out.html contains this:
> <html><body><table border="1"><tr><td><font size="+2"
>face="Times"><b>One</b>tw</font></td><td><font size="+2"
>face="Times"><b>One</b>tw</font></td></tr></table></body></html
>
> Now either I'm not doing something right, or this is some sort of bug.
> Could someone please advise on how to get around this problem?
>
> ---
> [EMAIL PROTECTED]
> Sum Ergo Cogito
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]