ITabRange.PasteFromStream

Fore Syntax

PasteFromStream(SrcStream: IIOStream);

Fore.NET Syntax

PasteFromStream(SrcStream: System.IO.Stream);

Parameters

SrcStream. The stream, from which inserting is performed.

Description

The PasteFromStream method pastes data from the specified stream to the current range.

Comments

Before executing the method the cursor in the stream must be set to the start position: IIOStream.Position=0. Data must be copied to the stream by means of the ITabRange.CopyToStream method.

Fore Example

Executing the example requires that the repository contains a form with the Button1 and Button2 buttons, the UiTabSheet component named UiTabSheet1 and any visualizers, for which UiTabSheet1 is set as a data source.

Class TESTForm: Form
    UiTabSheet1: UiTabSheet;
    TabSheetBox1: TabSheetBox;
    Button1: Button;
    Button2: Button;
    MStream: IMemoryStream;
    TSheet: ITabSheet;

    Sub TESTFormOnCreate(Sender: Object; Args: IEventArgs);
    Begin
        TSheet := UiTabSheet1.TabSheet;
        MStream := New MemoryStream.Create;
    End Sub TESTFormOnCreate;

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Begin
        MStream.Clear;
        TSheet.View.Selection.Range.CopyToStream(MStream);
    End Sub Button1OnClick;

    Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
    Begin
        If MStream.Size > 0 Then
            MStream.Position := 0;
            TSheet.View.Selection.Range.PasteFromStream(MStream);
        End If;
    End Sub Button2OnClick;
End Class TESTForm;

When the form is started, the stream is initialized in the memory, which will be used for data exchange. Clicking the Button1 button copies data of the currently selected table range to the stream. Clicking the Button2 pastes the stream data to the currently selected range.

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.Tab;

Public Partial Class TESTForm: Prognoz.Platform.Forms.Net.ForeNetForm
    Public Constructor TESTForm();
    Begin
        InitializeComponent();
    End Constructor;

    TSheet: TabSheet;
    MStream: System.IO.MemoryStream = New System.IO.MemoryStream();

    Private Sub TESTForm_Activated(sender: System.Object; e: System.EventArgs);
    Var
        TStyle: ITabTableStyle;
    Begin
        TSheet := uiTabSheetNet1.TabSheetUi.TabSheet;
    End Sub;

    Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
    Begin
        MStream.SetLength(0);
        TSheet.View.Selection.Range.CopyToStream(MStream);
    End Sub;

    Private Sub button2_Click(sender: System.Object; e: System.EventArgs);
    Begin
        If MStream.Length > 0 Then
            MStream.Position := 0;
            TSheet.View.Selection.Range.PasteFromStream(MStream);
        End If;
    End Sub;
End Class;

See also:

ITabRange