Delphi .NET (2) Database (71) Delphi IDE (90) Network (39) Printing (3) Strings (12) VCL (83) Windows with Delphi (280)
Exchange Links About this site Links to us 
|
Send a TStringList to the printer
This article has not been rated yet. After reading, feel free to leave comments and rate it.
The easiest way to print a couple of strings is using the function AssignPrn from the Printers unit.
Use the following function e.g. like this
PrintStrings(Memo1.Lines); to print out a memo field.
 | |  | | uses Printers;
procedure PrintStrings (S: TStrings);
var
Prn : TextFile;
i : word;
begin
AssignPrn(Prn);
try
Rewrite(Prn);
try
for i:=0 to S.Count-1 do
writeln(Prn, S.Strings[i]);
finally
CloseFile(Prn);
end;
except
on EInOutError do MessageDlg('Fehler!', mtError, [mbOk], 0);
end;
end; | |  | |  |
Comments:
|