ITabRange.PasteFromStream

Syntax

PasteFromStream(SrcStream: IIOStream);

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.

It is used only in the desktop application.

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.

See also:

ITabRange