如果你执意用Memo就见下面的代码
procedure TKmCheckForm.ToolButton4Click(Sender: TObject);
var
MyPrinter:TextFile;
PrnRun:integer;
OldFontName:String;
OldFontSize:integer;
begin
if Memo1.Lines.Count>0 then
begin
KmAnsiForm.ShowModal;
if KmAnsiForm.Label2.Caption='1' then
begin
//保存以前的字体信息
OldFontName:=Printer.Canvas.Font.Name;
OldFontSize:=Printer.Canvas.Font.Size;
Printer.Canvas.Font.Name:='宋体';
Printer.Canvas.Font.Size:=10;
//设置缺省打印机
Printer.PrinterIndex:=-1;
//将打印机和指定文本关联
AssignPrn(MyPrinter);
//初始文本
ReWrite(MyPrinter);
for PrnRun:=1 to Memo1.Lines.Count-1do
begin
//将文本内容送打印机
Writeln(MyPrinter,Memo1.Lines[PrnRun]);
end;
//关闭文本
CloseFile(MyPrinter);
//重置打印机字体信息
Printer.Canvas.Font.Name:=OldFontName;
Printer.Canvas.Font.Size:=OldFontSize;
end;
end;
end;