Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Mon Dec 13, 2004 2:20 pm Post subject: Printing a table |
|
|
just want to share a way i have found to print the contents of a table with all the data lining up as it should and with the option of having a basic grid as well - the trick to lining up the data in the printout is to use @FILL()
the code comes directly from a program that i am hoping to release very soon ... the program uses a table with 9 entries but only some of the entries i want to print ... and with the given headers
Code: | if @greater(@count(table1),0)
list create, 10
list add, 10, %%caption (@datetime(dd mmmm yyyy hh:nn am/pm))
list add, 10,
list add, 10, ----------------------------------------|-------|-----------|--------|--------|--------
list add, 10, @fill(40,Keyword)|@fill(6,Demand) |@fill(10,Supply) |@fill(7,KEI) |@fill(7,@chr(34)Supply@chr(34)) |@fill(8,@chr(34)KEI@chr(34))
list add, 10, ----------------------------------------|-------|-----------|--------|--------|--------
%i = 0
option fieldsep, @tab()
repeat
list seek, table1, %i
parse "%1;%2;%3;%4;%5;%6;%7;%8;%9",@item(table1)
list add, 10, @fill(40,%2)|@fill(6,%3) |@fill(10,%5) |@fill(7,%6) |@fill(7,% |@fill(8,%9)
list add, 10, ----------------------------------------|-------|-----------|--------|--------|--------
%i = @succ(%i)
until @equal(%i,@count(table1))
list print, 10, courier, 10
list close, 10
option fieldsep, |
end
|
i would recommend using a non proportional font when printing this way otherwise the data will not line up properly on the print out
serge _________________
|
|