09-18-2020, 01:30 PM
(This post was last modified: 09-18-2020, 09:51 PM by Jose Nilton Pace.
Edit Reason: Format code
)
(09-15-2020, 09:22 AM)Alexandre Machado Wrote: Most developers create PDF based reports which are the standard for web reports.
There are a couple of demos that show how the basics should work when generating a report. More specifically, using the file cache.
You basically generate a PDF file using any report generator, including Crystal, and add it to the cache. Then you just use it as any PDF file in a web application.
For instance this one: https://github.com/Atozed/IntraWeb/tree/...eTimeCache
Also,
Just make sure that your report writer is set to be threadsafe.
here is some example code for reportbuilder
Code:
procedure fxProcess_Report(ARBreport:TppReport;Output_type:string; Send_Stream:boolean=false;AFileName:string='';APdfPassword:string='');
var lFileName,
lURL,
lFileDir:string;
lMS : TMemoryStream;
lPDFDevice: TppPDFDevice;
begin
lFileName := 'test';
try
with ARBreport do
begin
AllowPrintToFile := False;
ShowPrintDialog := False;
TextFileName := lFileDir;
DeviceType := 'PDF';
ModalCancelDialog := false;
ModalPreview := false;
ShowCancelDialog := false;
lMS := TMemoryStream.Create;
lPDFDevice := TppPDFDevice.Create(nil);
try
lPDFDevice.PDFSettings := ARBreport.PDFSettings;
lPDFDevice.OutPutSTream := lMS;
lPDFDevice.Publisher := ARBreport.publisher;
ARBreport.PrintToDevices;
lURL := IWappCache.TIWAppCache.StreamToCacheFile(WebApplication, lMS, TIWMimeTypes.GetAsString('.' + 'PDF'), ctOneTime);
// WebApplication.SendStream(MS,false,HD.ContentType,Afilename);
WebApplication.NewWindow( lURL
, 'Report'
, 0
, 0
, [woResizable, woDetectBlock]
);
finally
lPDFDevice.free;
lMS.free;
end;
end;
except
raise;
end;
end;
