IPrxReport.LoadFromStream

Fore Syntax

LoadFromStream(Stream: IIOStream);

Fore.NET Syntax

LoadFromStream(Stream: System.IO.Stream);

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.

Fore 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.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.KeFore;
Imports System.IO;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    MB: IMetabase;
    Report: IPrxReport;
    RepStream: Stream;
Begin
    MB := Self.Metabase;
    RepStream := New MemoryStream.Create();
    //Open regular report
    Report := MB.ItemById["REPORT"].Edit() As IPrxReport;
    Report.SaveToStream(RepStream, PrxReportSaveMode.prsmDefinitionOnly);
    RepStream.Position := 0;
    Report.LoadFromStream(RepStream);
    //Output regular report to component on form
    uiReportNet1.ReportUi.OperationMode := UiMetabaseObjectOperationMode.oomExternal;
    uiReportNet1.Active := True;
    uiReportNet1.ReportUi.Instance := Report;
    RepStream := Null;
End Sub;

See also:

IPrxReport