Registriert seit: 6. Apr 2005
10.109 Beiträge
|
Re: Mehrere Memo´s auf einem Blatt drucken.
12. Nov 2007, 12:01
Es kann nur so funktionieren:
Delphi-Quellcode:
// ...
begin
AssignPrn(PrintText);
Rewrite(PrintText);
Printer.Canvas.Font.Assign(Memo1.Font);
Printer.Canvas.Font.size := 15;
// ...
end;
EDIT: Nachschlag
Delphi-Quellcode:
function FormatLine(lines1, lines2: TStrings;
index, leftColWidth, colDist, leftMargin: Integer;
var line: string
): Boolean;
var
line1, line2: string;
begin
line1 := IfThen(index < lines1.Count, lines1[index]);
line2 := IfThen(index < lines2.Count, lines2[index]);
line := Format('%s%*s%s%s', [
StringOfChar('+', leftMargin),
leftColWidth,
line1,
StringOfChar('+', colDist),
line2
]);
Result := (index < lines1.Count) or (index < lines2.Count);
end;
procedure TDemoForm.Button3Click(Sender: TObject);
const
LEFT_COL_WIDTH = 10;
COL_DIST = 2;
LEFT_MARGIN = 5;
var
index: Integer;
line: string;
PrintText: TextFile;
begin
AssignPrn(PrintText);
Rewrite(PrintText);
Printer.Canvas.Font.Assign(Memo1.Font);
Printer.Canvas.Font.size :=15;
index := 0;
while FormatLine(Memo1.Lines, Memo2.Lines, index, LEFT_COL_WIDTH, COL_DIST, LEFT_MARGIN, line) do
begin
Writeln(PrintText, line);
Inc(index);
end;
CloseFile(PrintText);
end;
Getippt und nicht getestet.
|
|
Zitat
|