Hallo,
ich würde meinen, dass alle Zeilen des Memos in eine Zeile gedruckt werden da die Zeilenumbrüche ignoriert werden.
Nach kurzer suche habe ich folgendes gefunden
Printing the Contents of a TMemo Field:
Delphi-Quellcode:
//This Procedure will print the contents of a Memo field with a left margin and page numbers in the top right corner.
procedure PrintStrings(Strings : TStrings);
var
I, Line, lm, r : integer;
pn : string;
begin
Line := 0;
Printer.Canvas.Font := Form1.Memo1.Font;
Printer.Begindoc;
lm := Printer.PageWidth div 12;
pn := 'Page ' + IntToStr(Printer.PageNumber);
r := Printer.PageWidth - Printer.Canvas.TextWidth(pn);
Printer.Canvas.TextOut(r, Line, pn);
Line := Line + 3 * Abs(Printer.Canvas.Font.Height);
for I := 0 to Strings.Count - 1 do
begin
Printer.Canvas.TextOut(lm, Line, Strings[I]);
Line := Line + Abs(Printer.Canvas.Font.Height);
if (Line >= Printer.PageHeight) then
begin
Printer.NewPage;
Line := 0;
pn := 'Page ' + IntToStr(Printer.PageNumber);
r := Printer.PageWidth - Printer.Canvas.TextWidth(pn);
Printer.Canvas.TextOut(r, Line, pn);
Line := Line + 3 * Abs(Printer.Canvas.Font.Height);
end;
end;
Printer.EndDoc;
end;
procedure TForm1.Print1Click(Sender: TObject);
begin
PrintStrings(Memo1.Lines);
end;