1

我们将 Intraweb 用于我们的 Web 应用程序,并且一直在使用 ReportBuilder 为我们的内部 Windows 应用程序进行报告。我们还有 ExtraDevices,我们使用它可以将 ReportBuilder 报告保存为 Excel 文件。

现在,我想以 PDF 文件的形式生成一份关于我们的 Web 应用程序的报告。我有一个关于如何使用 ExtraDevices 完成的示例。但是,以下示例如何通过 Intraweb 进行更改?

procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject; Request:
  TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
  HD: TPDFDevice;
  MS: TMemoryStream;
begin
  MS := TMemoryStream.Create;
  HD := TPDFDevice.Create(Self);
  HD.PrintToStream := True;
  HD.ReportStream := MS;
  HD.Publisher := Rpt.Publisher;
  Rpt.PrintToDevices;
  Response.ContentType := HD.ContentType;
  Response.ContentStream := MS;
  Response.SendResponse;
  HD.Free;
end;
4

2 回答 2

1

我想我找到了我的问题的答案。我只需要使用 TIWApplication.SendStream。

代码将这样修改:

procedure TfrmSomeIWForm.SomeBtnClick(Sender: TObject);
var
  HD: TPDFDevice;
  MS: TMemoryStream;
begin
  MS := TMemoryStream.Create;
  HD := TPDFDevice.Create(Self);
  HD.PrintToStream := True;
  HD.ReportStream := MS;
  HD.Publisher := Rpt.Publisher;
  Rpt.PrintToDevices;
  WebApplication.SendStream(MS,false,HD.ContentType);
  HD.Free;
end;
于 2009-10-20T18:06:09.860 回答
0

您看过 Intraweb 附带的 RaveDemo 吗?我相信它可以满足您的需求,但使用 Rave Reports。不久前,我用它构建了一个 Intraweb ReportBuilder PDF 版本。

我不确定它是否会流式传输报告。自从我查看它已经有一段时间了,但我认为它可能会将其保存到磁盘而不是像您的示例那样从内存中发送响应。

于 2009-10-20T17:53:20.307 回答