IPrxReport.LoadFromStream

Syntax

LoadFromStream(Stream: IIOStream);

Parameters

Stream. The stream that contains the regular report.

Description

The LoadFromStream method loads regular report form the stream passed by the Stream parameter.

Comments

A regular report can be saved to stream using the SaveToStream method, or it can be loaded from a user-defined field of the table. For more details about working with custom fields, see the knowledge base in the Working with Fields That Have Custom Data Type article.

Example

Executing the example requires that the repository contains:

Add links to the Fore, IO, Metabase system assemblies.

The example is a handler of the OnClick event for the Button1 component.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    Report: IPrxReport;
    RepStream: IIOStream;
Begin
    MB := MetabaseClass.Active;
    RepStream := New MemoryStream.Create;
    //Open regular report
    Report := MB.ItemById("REPORT").Edit As IPrxReport;
    Report.SaveToStream(RepStream, PrxReportSaveMode.DefinitionOnly);
    RepStream.Position := 0;
    Report.LoadFromStream(RepStream);
    //Output regular report to component on form
    UiReport1.OperationMode := UiMetabaseObjectOperationMode.External;
    UiReport1.Active := True;
    UiReport1.Instance := Report;
    Dispose RepStream;
End Sub Button1OnClick;

Clicking the button loads regular report by means of the LoadFromStream method from the RepStream stream to the UiReport1 component.

See also:

IPrxReport