LoadFromStream(Stream: IIOStream);
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.
See also: