PasteFromStreamEx(
SrcStream: IIOStream;
PasteMode: TabPasteMode;
[SkipEmptyCells: Boolean = False;]
[Transpose: Boolean = False]);
SrcStream. The stream, from which data is inserted.
PasteMode. Insert mode.
SkipEmptyCells. Indicates whether empty cells are skipped.
Transpose. Indicates whether data should be transposed on insert.
The PasteFromStreamEx method inserts data from the specified stream to the current range according to the set insert parameters.
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.
If the inserted data contains empty cells, and the SkipEmptyCells parameter is set to True, formulas, formatting and comments are inserted for these cells.
It is used only in the desktop application.
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.PasteFromStreamEx(MStream, TabPasteMode.Values, True, True);
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 button special pastes to the currently selected range: only range values, the range is transposed, formatting, comments and formulas of empty cells are skipped.
See also: