Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rich edit print command

Status
Not open for further replies.

sanjna000

Programmer
Aug 1, 2003
132
GB
Hi,
I need to print the contents of the rich edit control when clicking the relevant tool button. The code i used is as follows:

If PrintDlg.Execute Then
RE_Viewer.Print(RE_Viewer.Lines.Text);

I tried to print the contents of the rich edit control by clicking the tool button. But it does not seem to be working. Does any one know how to give the print command.
Thank you so much for u r help in advance.

Sanjna...
 
G'day Sanjna!
Do you have a tool/button with a print dialog attached?

If so, then it looks like what your doing wrong is loading the text into the caption for the job!
Try this (from the help in Delphi, put a button on the form to print your richedit)...
[tt]
procedure TForm1.FormCreate(Sender: TObject);
const
// The path may need to be changed to accommodate locations of files
// on your system.
Path = '..\DEMOS\RICHEDIT\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;
[/tt]

Cheers


Chris ;-)
 
Hi Chris,

Thank you so much for u r help. It worked perfectly well.
Thanks again

Sanjna...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top