Formatting Printer Output
I like to print out some Records on my printer. From this conference
I have learned how to send output to the printer, but not how to
format it in neat columns.
When displaying a list of the records I use the GotoXY command to line
things up. I'd like to use a simular command (if it exists) to
format the output of the printer.
My records consist of types String[20] and reals. I'd like the output
to look like...
SE2546BK 521-2345653 432.21 31 Jan 96
SJ2343M 421-23232322 123.21 12 Mar 97
VR2120 8881100 88.32 01 May 99
With thanks,
Michael LeChasseur
my current code looks like this..
const
MaxItems = 500;
type
ItemRange = 1..MaxItems;
MixedType = string[12];
DateType = string[14];
Item = record
Model : MixedType;
Serial : MixedType;
Cost : real;
DatePurchased : DateType;
end; {record}
StockType = record
AllItems : array[ItemRange] of Item;
counter : integer;
end; {record}
.....
{ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
Procedure call_print(var Stock : StockType);
var
Lst : Text; i : integer; TotalCost : real;
Begin
Assign(Lst, 'LPT1');
Rewrite(Lst);
Writeln(Lst,' Model # Serial # Cost Date
Purchased');
for i := 1 to stock.counter do
begin
Write (Lst, ' ',i,'. ');
Write (Lst, ' ', stock.allitems[i].model, ' ');
Write (Lst, stock.allitems[i].serial, ' ');
Write (Lst, stock.allitems[i].cost:7:2, ' ');
TotalCost := TotalCost + stock.allitems[i].cost;
Writeln(Lst, stock.allitems[i].datepurchased);
end; {i loop}
Writeln(Lst);
Write(Lst, ' Total Cost : $ ', TotalCost:8:2, ' ');
Close(Lst);
readln;
End; {call_printer}