views:

529

answers:

3

How can I preview a rave report on a Delphi form? I have a page control with 2 pages: on the first one the user enter some data (name, address...) and I want on the second page to preview the report generated with the data from the first page.

A: 

I've used print preview, it's not exactly same but in my application it was enough. I don't know if it's possible to embedded inside page control.

Harriv
+2  A: 

You can render a preview to any TScrollBox with a TRvRenderPreview:

With a TRvSystem:

   RvRenderPreview1.ScrollBox := ScrollBox1; // a scrollbox on a TTabSheet

   RvSystem1.DefaultDest := rdFile;
   RvSystem1.SystemSetups := RvSystem1.SystemSetups - [ssAllowSetup];

   RvSystem1.RenderObject := RvRenderPreview1;
   RvSystem1.DoNativeOutput := false;

   RvSystem1.Execute;
jasonpenny
+1  A: 

You can use the TRvNDRWriter component instead of the TRvSystem.

procedure TForm1.Button1Click(Sender: TObject);
begin
  RvProject1.Execute;
  RvRenderPreview1.Render;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  ms: TMemoryStream;
begin
//  RvNDRWriter1.StreamMode := smUser;
//  RvRenderPreview1.ScrollBox := ScrollBox1;
  ms := TMemoryStream.Create;
  RvNDRWriter1.Stream := ms;
  RvRenderPreview1.NDRStream := ms;
end;
max