on 01-24-2008 5:03 PM
Hi,
I want insert different lines into a String, for example, I want tho show a String like this:
Line 1
Line 2
Line 3...
I've wrote the next code: String lines = "Line 1" + "\n" + "Line 2" + "\n"...
myrow.addElement(lines).
When I show my model, it show so: Line1 Line2 Line3..., but when I open a pdf file with the model, it show so:
Line 1
Line 2
Line 3
Why in my model show: Line 1 Line 2.. but in pdf show in differents lines?
How I can show in muy model in differents lines?
> I've wrote the next code: String lines = "Line 1" + "\n" + "Line 2" + "\n"...
> myrow.addElement(lines).
> When I show my model, it show so: Line1 Line2 Line3...
Like the others, I don't know exactly how you "show your model", but could it be you are attempting to display it in a browser with HTML? In that case, line breaks are (normally) not interpreted; you could use
String linesHTML = "Line 1" + "<br/>" + "Line 2" + "<br/>" + ...
.
(Of course, this will not work in PDF format; you would have to use different Strings for the two formats).
Regards,
Jens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this
char lf = 0X0A;
char cr = 0X0D;
String lines = Line1lfcrLine2lfcrLine3;
For better performance, I advise to use the append operator (Stringbuffer) instead of the + operator (String).
StringBuffer sb = new StringBuffer();
sb.append(lf).append(cr).append(Line1).etc etc
The result is
sb.toString();
good luck, Roelof
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
can you just describe a bit closer which coding you are using (especially the coding for myrow)? Further some more information concerning the model might be helpful. Have you tried a coding like this:
"Line 1\n" + "Line 2\n" + ... If so what happens?
Brgds,
Marcel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.