문제

We use Intraweb for our Web Applications and also have been using ReportBuilder for reporting for our internal windows applications. We also have ExtraDevices which we've used to allow us to save our ReportBuilder reports as Excel files.

Now, I am want to produce a report on our web applications as a PDF file. I have an example on how that is done with ExtraDevices. However, how does the following example get changed with 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;
도움이 되었습니까?

해결책

I think I found the answer to my question. I simply need to use TIWApplication.SendStream.

The code would be modified this way:

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;

다른 팁

Have you seen the RaveDemo that ships with Intraweb? I believe it does what you're looking for but with Rave Reports. I used it to build an Intraweb ReportBuilder PDF version a while back.

I'm not sure if it streams the report though. It's been a while since I looked at it but I think it may save it to disk rather than send the response from memory like your example.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top