Printing content of a memo

Please discuss general Delphi programming topics here.

Printing content of a memo

Postby Kirbster » October 24th, 2003, 4:50 pm

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
Kirbster
Member
Member
 
Posts: 3
Joined: October 24th, 2003, 12:41 pm

Postby Kambiz » October 24th, 2003, 7:25 pm

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.
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby Johnny_Bit » October 25th, 2003, 7:56 am

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;
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron