RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomRichEdit.Print Method

Formats and prints the contents of the rich edit control.

Pascal
procedure Print(const Caption: string); virtual;
C++
virtual __fastcall Print(const AnsiString Caption);

Use Print to print the contents of a rich edit control. The Caption parameter specifies the title that appears in the print manager and on network title pages.  

C++ Examples: 

 

/*
Place a button and a richedit on the form.  No print dialog
appears.  The contents of the richedit is printed to the
currently configured printer.
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
// you may need to change this path to suit your environment
  char const *Path = "..\\OVERVIEW.RTF";
  RichEdit1->Lines->LoadFromFile(Path);
}

void __fastcall TForm1::Button1Click(TObject *Sender)
{
// The parameter string shows in the print queue under "Document   // name".
  RichEdit1->Print("My Document Name");
}

 

Delphi Examples: 

{
Place a button and a richedit on the form.  No print dialog
appears.  The contents of the richedit is printed to the
currently configured printer.
}
procedure TForm1.FormCreate(Sender: TObject);
const
  // The path may need to be changed to accommodate
  // locations of files on your system.
  Path = 'OVERVIEW.RTF';
begin
   RichEdit1.Lines.LoadFromFile(Path);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  // The parameter string shows in the print queue
  // under "Document/name".
  RichEdit1.Print('My Document Name');
end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!