LoadFromStream(Stream: IIOStream);
LoadFromStream(Stream: System.IO.Stream);
Stream. The stream that contains the regular report.
The LoadFromStream method loads regular report form the stream passed by the Stream parameter.
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.
Executing the example requires that the repository contains:
A regular report with the REPORT identifier.
A form containing the Button component named Button1, the ReportBox component named ReportBox1, and the UiReport component named UiReport1. Specify the UiReport1 component as a data source for the ReportBox1 component.
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.
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: