delphi怎么打印文件
发布网友
发布时间:2024-03-09 17:24
我来回答
共4个回答
热心网友
时间:2024-03-10 13:07
procere TForm1.PrinterSetupExecute(Sender: TObject);
begin
PrinterSetupDialog1.Execute;
end;
procere TForm1.PrintExecute(Sender: TObject);
begin //列印分页
if PrintDialog1.Execute=True then
RichEdit1.Print(Form1.Caption);
end;
or
if printdialog1.execute then
PrintStrings(RichEdit1.Lines);
热心网友
时间:2024-03-10 13:07
放一个 richedit到窗口上,把需要打印的txt加进去,然后调用richedit的print
热心网友
时间:2024-03-10 13:08
uses ComCtrls;
procere 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');
热心网友
时间:2024-03-10 13:08
procere TForm1.Button1Click(Sender: TObject);
begin
self.RichEdit1.Print('我的打印文件');
end;