I am trying to format a string to look like an html table without using html. Sample output goal:
I don't know how to take into account different lengths of the values. For instance, if value2 is 15 characters long, it pushes value3 and value4 over. This is bad because I have a fixed width that I am working with. And if value6 is very small (3 characters) value7,8,9 are misaligned.
OK, I know everything got messed up, but imagine the headings and the values line up like a normal table. Any help or ideas are appreciated. Thanks
[This message has been edited by Grant Morris (edited August 08, 2001).] (edited by Cindy to format example table) [This message has been edited by Cindy Glass (edited August 08, 2001).]
Larry Anderson
Greenhorn
Joined: Aug 06, 2001
Posts: 26
posted
0
Have you tried escape characters like \t (tab) or anything? Is this just a formatting problem? You can also use the .length property on a string to get its length.
Matt Senecal
Ranch Hand
Joined: Dec 01, 2000
Posts: 255
posted
0
First of all, make sure you're using a font where all the characters are the same width. This will make your job much easier. Something you might want to try: Figure out the longest allowable value width (say, X characters). Pick a slightly wider size to be the width of each row (Y characters). As each value is added to the "table" figure (and this is in pseudocode):
That's ugly pseudocode, I know, but hopefully you'll get the idea.
Originally posted by Grant Morris: I am trying to format a string to look like an html table without using html. Sample output goal: Heading1 Heading2 Heading3 value1 value2 value3 value6 value7 value8
I don't know how to take into account different lengths of the values. For instance, if value2 is 15 characters long, it pushes value3 and value4 over. This is bad because I have a fixed width that I am working with. And if value6 is very small (3 characters) value7,8,9 are misaligned.
OK, I know everything got messed up, but imagine the headings and the values line up like a normal table. Any help or ideas are appreciated. Thanks
[This message has been edited by Grant Morris (edited August 08, 2001).]
There's nothing more dangerous than a resourceful idiot. ---Dilbert
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.