making a preview of my richedit

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

making a preview of my richedit

Postby alexhaifa » May 6th, 2007, 6:38 pm

Hello,

I am having problens to understand the right way to make this:

I have a form with a rxrichedit, I would like to make a print preview from my text, but I took a look at the examples and I understood some parts, could you help me ?

What is the easiest way to preview the text?
How can I work with rxRichedit and not richedit?

Help me with a simple example

Thanks very much
:?
alexhaifa
Junior Member
Junior Member
 
Posts: 35
Joined: November 22nd, 2005, 2:01 pm
Location: Brazil

Postby Kambiz » May 6th, 2007, 10:25 pm

The following code is the easiest way to print/preview a rich text.

Code: Select all
with PrintPreview do
begin
  BeginDoc;
  PaintRichText(PageBounds, RichEdit1, 0, nil);
  EndDoc;
end;

The rxRichEdit control is much better than Delphi's RichEdit control. Just consider that you have to type cast rxRichEdit to TCustomRichEdit when passing to PaintRichText method.

Code: Select all
with PrintPreview do
begin
  BeginDoc;
  PaintRichText(PageBounds, TCustomRichEdit(rxRichEdit1), 0, nil);
  EndDoc;
end;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby alexhaifa » May 7th, 2007, 11:10 am

Thanks very very much for your help.

Yeah, you are right regarding to rxrichedit, it is better than richedit and hence I am using it.
alexhaifa
Junior Member
Junior Member
 
Posts: 35
Joined: November 22nd, 2005, 2:01 pm
Location: Brazil

Postby alexhaifa » May 7th, 2007, 11:50 am

Kambiz,

I could notice that my rxrichedit has many lines and when I ran your code, I could notice that it compress all the lines in one preview page, how could I split it into pages and thumbnailpreview.

I tried to find a help how to work with print preview but I didn't find any.
I imagine that there isn't any :(
alexhaifa
Junior Member
Junior Member
 
Posts: 35
Joined: November 22nd, 2005, 2:01 pm
Location: Brazil

Postby Kambiz » May 7th, 2007, 1:42 pm

The PaintRichText method automatically splits rich text in several pages as needed. I guess the font size of your text is too small for printer's resolution, or it is a raster font.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 1 guest

cron