TX Text Control .NET for WPF

Load Method

Method
Namespace
TXTextControl
Package
TXTextControl.TextControl.WPF.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Exchanges the currently selected text with text in a certain format.

Syntax

Load()

Opens a dialog box to select a file and exchanges the currently selected text with the text from that file.

public Selection.DialogResult Load();

Load(StreamType)

Opens a dialog box to select a file in the specified format and exchanges the currently selected text with the text from that file.

public Selection.DialogResult Load(StreamType streamType);
ParameterDescription
streamType

Specifies one of the StreamType values.

Load(string, StreamType)

Exchanges the currently selected text with text in the specified format. The new text is read from the specified file.

public void Load(string path, StreamType streamType);
ParameterDescription
path

Specifies a file from which the data is loaded.

streamType

Specifies one of the StreamType values.

Load(FileStream, StreamType)

Exchanges the currently selected text with text in the specified format. The new text is read from the specified file stream.

public void Load(FileStream fileStream, StreamType streamType);
ParameterDescription
fileStream

Specifies a file from which the data is loaded. The data is loaded from the stream's current position.

streamType

Specifies one of the StreamType values.

Load(byte[], BinaryStreamType)

Exchanges the currently selected text with text in the specified format. The new text is read from the specified byte array.

public void Load(byte[] binaryData, BinaryStreamType binaryStreamType);
ParameterDescription
binaryData

Specifies a byte array from which the data is loaded.

binaryStreamType

Specifies one of the BinaryStreamType values.

Load(string, StringStreamType)

Exchanges the currently selected text with text in the specified format. The new text is read from the specified string.

public void Load(string stringData, StringStreamType stringStreamType);
ParameterDescription
stringData

Specifies a string from which the data is loaded.

stringStreamType

Specifies one of the StringStreamType values.

Load(StreamType, LoadSettings)

Opens a dialog box to select a file in the specified format and exchanges the currently selected text with the text from that file using the specified special settings.

public Selection.DialogResult Load(StreamType streamType, LoadSettings loadSettings);
ParameterDescription
streamType

Specifies one of the StreamType values.

loadSettings

Specifies a LoadSettings object with additional information and settings for the load operation.

Load(string, StreamType, LoadSettings)

Exchanges the currently selected text with text in the specified format. The new text is read from the specified file and loaded using the given special settings.

public void Load(string path, StreamType streamType, LoadSettings loadSettings);
ParameterDescription
path

Specifies a file from which the data is loaded.

streamType

Specifies one of the StreamType values.

loadSettings

Specifies a LoadSettings object with additional information and settings for the load operation.

Load(FileStream, StreamType, LoadSettings)

Exchanges the currently selected text with text in the specified format. The new text is read from the specified file stream and loaded using the given special settings.

public void Load(FileStream fileStream, StreamType streamType, LoadSettings loadSettings);
ParameterDescription
fileStream

Specifies a file from which the data is loaded. The data is loaded from the stream's current position.

streamType

Specifies one of the StreamType values.

loadSettings

Specifies a LoadSettings object with additional information and settings for the load operation.

Load(byte[], BinaryStreamType, LoadSettings)

Exchanges the currently selected text with text in the specified format. The new text is read from the specified byte array and loaded using the given special settings.

public void Load(byte[] binaryData, BinaryStreamType binaryStreamType, LoadSettings loadSettings);
ParameterDescription
binaryData

Specifies a byte array from which the data is loaded.

binaryStreamType

Specifies one of the BinaryStreamType values.

loadSettings

Specifies a LoadSettings object with additional information and settings for the load operation.

Load(string, StringStreamType, LoadSettings)

Exchanges the currently selected text with text in the specified format. The new text is read from the specified string and loaded using the given special settings.

public void Load(string stringData, StringStreamType stringStreamType, LoadSettings loadSettings);
ParameterDescription
stringData

Specifies a string from which the data is loaded.

stringStreamType

Specifies one of the StringStreamType values.

loadSettings

Specifies a LoadSettings object with additional information and settings for the load operation.

Return Value

The implementations which open a dialog box return a Selection.DialogResult value.

Examples

The following example formats the heading of a short document by using Selection.Load.

textControl.Text = "Quarterly results\nRevenue increased by 12%.";
textControl.Select(0, 17);
Selection selection = textControl.Selection;

selection.Load(@"{\rtf1\ansi Sample document}", StringStreamType.RichTextFormat);
Console.WriteLine("Selection is ready for use.");

Remarks

The methods opening a dialog box are not available through the Selection object of a ServerTextControl.