Delphi - 预览表单上的 Rave 报告

发布于 2024-08-08 15:10:15 字数 96 浏览 3 评论 0原文

如何在 Delphi 表单上预览 rave 报告? 我有一个包含两页的页面控件:在第一页上,用户输入一些数据(名称、地址...),我想在第二页上预览使用第一页中的数据生成的报告。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

悲念泪 2024-08-15 15:10:15

您可以使用 TRvRenderPreview 将预览渲染到任何 TScrollBox:

使用 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;

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;
时光礼记 2024-08-15 15:10:15

您可以使用 TRvNDRWriter 组件代替 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;

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;
七堇年 2024-08-15 15:10:15

我使用过打印预览,它不完全相同,但在我的应用程序中已经足够了。不知道是否可以嵌入到页面控件中。

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.

永言不败 2024-08-15 15:10:15

使用 TRvProject + TRvNDRWriter + TRvRenderPreview + TMemoryStream + TScrollBox

procedure TForm1.FormCreate(Sender: TObject);
begin
  FNdrStream := TMemoryStream.Create;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  FNdrStream.Free;
end;

procedure TForm1.btnPreviewClick(Sender: TObject);
begin
  //load report project file. You can use stored RAV instead
  rvProject.ProjectFile := 'C:\ExecutaveisGerados\Exemplos\sampleRave\sampleRave.rav';
  rvProject.Open;

  //tells rave we will write the report result to a NDR
  rvProject.Engine := rvNdrWriter;

  //ensure empty memory stream
  FNdrStream.Clear;

  //tells NDRWriter where to store ndr file (memory stream)
  rvNdrWriter.StreamMode := smUser;
  rvNdrWriter.Stream := FNdrStream;

  //execute the report using the NDRWriter. Now the Stream holds the NDR file
  rvProject.Execute;

  //tells RenderPreview where to display
  rvRenderPreview.ScrollBox := sbReportPreview;

  //display NDR file from memory stream
  rvRenderPreview.Render(FNdrStream);
end;

Using TRvProject + TRvNDRWriter + TRvRenderPreview + TMemoryStream + TScrollBox

procedure TForm1.FormCreate(Sender: TObject);
begin
  FNdrStream := TMemoryStream.Create;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  FNdrStream.Free;
end;

procedure TForm1.btnPreviewClick(Sender: TObject);
begin
  //load report project file. You can use stored RAV instead
  rvProject.ProjectFile := 'C:\ExecutaveisGerados\Exemplos\sampleRave\sampleRave.rav';
  rvProject.Open;

  //tells rave we will write the report result to a NDR
  rvProject.Engine := rvNdrWriter;

  //ensure empty memory stream
  FNdrStream.Clear;

  //tells NDRWriter where to store ndr file (memory stream)
  rvNdrWriter.StreamMode := smUser;
  rvNdrWriter.Stream := FNdrStream;

  //execute the report using the NDRWriter. Now the Stream holds the NDR file
  rvProject.Execute;

  //tells RenderPreview where to display
  rvRenderPreview.ScrollBox := sbReportPreview;

  //display NDR file from memory stream
  rvRenderPreview.Render(FNdrStream);
end;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文