Page 1 of 1

how to print the content of editbox in cells?

Posted: Tue Jul 20, 2010 7:51 am
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

Posted: Tue Jul 20, 2010 3:37 pm
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.

Posted: Tue Jul 20, 2010 11:11 pm
by maomi1997
I use tcxtextedit

Posted: Tue Jul 20, 2010 11:27 pm
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;

Posted: Tue Jul 20, 2010 11:47 pm
by maomi1997
screen show

Image

print out pdf format

Image

Posted: Wed Jul 21, 2010 4:06 pm
by maomi1997
I find I chang tcxedittext to Tedit,the content of contorl can print

Posted: Wed Jul 21, 2010 5:22 pm
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.

Posted: Thu Jul 22, 2010 12:16 pm
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;

Posted: Thu Jul 22, 2010 2:00 pm
by maomi1997
thank your repaly.