how to print the content of editbox in cells?

General TRichView support forum. Please post your questions here
Post Reply
maomi1997
Posts: 16
Joined: Mon Jul 19, 2010 3:26 am

how to print the content of editbox in cells?

Post by maomi1997 »

I insert some editbox in cells,but the print result didn't show the content
of editbox?
how can I do it?
help me,thanks
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

What's the class name of this edit box?

If RVPrint cannot print some controls, you need to help it by providing a bitmap with a control image, see OnPrintComponent event.
maomi1997
Posts: 16
Joined: Mon Jul 19, 2010 3:26 am

Post by maomi1997 »

I use tcxtextedit
maomi1997
Posts: 16
Joined: Mon Jul 19, 2010 3:26 am

Post by maomi1997 »

I can see the content of the editbox in the screen,but printer's output is blank when I print the richview.

Code: Select all

procedure TfrmCheck.btnPrintClick(Sender: TObject);
var printit:Boolean;
begin
 if dlgPrint1.Execute then
 begin
   printit:=True;
 end;
 if PrintIt then begin
    rvprnt1.AssignSource(rchvw1);
    rvprnt1.FormatPages(rvdoALL);
    if rvprnt1.PagesCount>0 then
      rvprnt1.Print('demo,1,False);
  end;
end;
maomi1997
Posts: 16
Joined: Mon Jul 19, 2010 3:26 am

Post by maomi1997 »

screen show

Image

print out pdf format

Image
maomi1997
Posts: 16
Joined: Mon Jul 19, 2010 3:26 am

Post by maomi1997 »

I find I chang tcxedittext to Tedit,the content of contorl can print
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

When a control is inserted in TRichViewEdit, it works just like if it is inserted in a form.
When printing, TRVPrint needs to create an image of this control. TRVPrint can do it for main standard controls, and tries to draw unknown controls using their PaintTo method. However, this method works not for all controls.
I contacted DevExpress support. I hope we will provide a solution tomorrow.
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

In the next update of TRichView, TcxTextEdit controls will be printed.

Before that update, you can use TRVPrint.OnPrintComponent event:

Code: Select all

uses CtrlImg;
procedure TForm1.RVPrint1PrintComponent(Sender: TCustomRVPrint;
  PrintMe: TControl; var ComponentImage: TBitmap);
begin
  if PrintMe is TcxTextEdit then begin
    ComponentImage := TBitmap.Create;
    ComponentImage.Width := PrintMe.Width;
    ComponentImage.Height := PrintMe.Height;
    TWinControl(PrintMe).PaintTo(ComponentImage.Canvas, 0, 0);
    end
  else
    ComponentImage := DrawControl(PrintMe);
end;
maomi1997
Posts: 16
Joined: Mon Jul 19, 2010 3:26 am

Post by maomi1997 »

thank your repaly.
Post Reply