Page 1 of 1

Printing content of a memo

PostPosted: October 24th, 2003, 4:50 pm
by Kirbster
Hello,

I am new to these forums, and quite new in Delphi programming (already one year of experience, but I've been learning everything by myself). I need help in printing contents of a TMemo component. I have NO idea how to do it.

Kirbster

PostPosted: October 24th, 2003, 7:25 pm
by Kambiz
If you use a TRichEdit instead of TMemo, or just before printing the text assign it to a Rich Edit control, you may find theTPrintPreview component useful.

PostPosted: October 25th, 2003, 7:56 am
by Johnny_Bit
Code: Select all
var
  RE: TRichEdit;
begin
  RE:=TRichEdit.Create(Self);
  re.Visible:=False;
  Re.Parent:=Self;
  Re.PlainText:=True;
  Re.Font:=Main.CurrentEditor.Font;
  Re.WordWrap:=Main.CurrentEditor.WordWrap;
  Re.Lines:=Main.CurrentEditor.Lines;
  ppPrint.BeginDoc;
  ppPrint.PaintRichText(Rect(Margins.Left,Margins.Top,ppPrint.PaperWidth - Margins.Right, ppPrint.PaperHeight-Margins.Bottom),RE, -1, nil);
  ppPrint.EndDoc;
  Re.Free;
  end;