IPrxPartialPersist.LoadFromStream

Syntax

LoadFromStream(Options: Integer; Stream: IIOStream);

Parameters

Options. The parameter is reserved. 0 is to be passed.

Stream. The stream, from which the report is loaded.

Description

The LoadFromStream method restores report from a stream.

Comments

This method is used together with IPrxPartialPersist.SaveToStream.

Example

Executing the example requires that the repository contains a regular report, which has an assigned event handler containing the code given below. The following system assemblies should be connected for the event handler: Io, Report, Ui.

Class EventsClass: ReportEvents
    
    
Public Sub OnBeforeExecuteReport(Report: IPrxReport; Var Cancel: Boolean);
    
Var
        stSaved: IIOStream;
    
Begin
        
If Not WinApplication.ConfirmationBox("Load saved?"Then
            
Return;
        
End If;
        stSaved := 
New FileStream.Create("c:\MyReport.rep", FileOpenMode.Read, FileShare.Exclusive);
        
Try
            (Report 
As IPrxPartialPersist).LoadFromStream(0, stSaved);
        
Finally
            
Dispose stSaved;
        
End Try;
        Cancel := 
True;
    
End Sub OnBeforeExecuteReport;
    
    
Public Sub OnAfterExecuteReport(Report: IPrxReport);
    
Var
        stFile: IIOStream;
    
Begin
        
If Not WinApplication.ConfirmationBox("Save calculated?"Then
            
Return;
        
End If;
        stFile := 
New FileStream.Create("c:\MyReport.rep", FileOpenMode.Create, FileShare.Exclusive);
        
Try
            (Report 
As IPrxPartialPersist).SaveToStream(0, stFile);
        
Finally
            
Dispose stFile;
        
End Try;
    
End Sub OnAfterExecuteReport;
    
End Class EventsClass;

After report calculation the following message is displayed: Save calculated?. If the answer is Yes, the report is saved to the specified file and report sheets are cleared. The following message is displayed before report calculation: Load saved?. Answer Yes to load report from the specified file. The report is not calculated.

See also:

IPrxPartialPersist