procedure TForm1.PrinterSetupExecute(Sender: TObject);
begin
PrinterSetupDialog1.Execute;
end;
procedure TForm1.PrintExecute(Sender: TObject);
begin //列印分页
if PrintDialog1.Execute=True then
RichEdit1.Print(Form1.Caption);
end;
or
if printdialog1.execute then
PrintStrings(RichEdit1.Lines);
uses ComCtrls;
procedure PrintTXT(const txtFileName:string);
var t:TRichEdit;
begin
try
t := TRichEdit.Create(nil);
t.Lines.LoadFromFile(txtFileName);
t.Print(t.text);
finally
FreeAndNil(t);
end;
end;
直接调用该函数即可 PrintTXT(‘D:\abc\123.txt‘);
原文:http://www.cnblogs.com/zhangzhifeng/p/5242073.html