TX Text Control .NET Server

LoadTextAsync Method

Method|Introduced in 21.0
Namespace
TXTextControl.Web
Package
None: the TX Text Control .NET Server setup installs it, for .NET Framework.
Assembly
TXTextControl.Web.dll

Description

Loads text in a certain format. The complete contents of a Text Control are replaced. This method returns immediately and does not wait for the text to be completely loaded.

Syntax

LoadTextAsync(String, Web.StreamType)

Loads text formatted with the specified format. The new text is read from the specified file.

public async System.Threading.Tasks.Task LoadTextAsync(string path,  Web.StreamType streamType);
ParameterDescription
path

Specifies a file from which the data is loaded.

streamType

Specifies one of the StreamType values.

LoadTextAsync(System.IO.FileStream, Web.StreamType)

Loads text formatted with the specified format. The new text is read from the specified file stream.

public async System.Threading.Tasks.Task LoadTextAsync(System.IO.FileStream fileStream, Web.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.

LoadTextAsync(Byte[], Web.BinaryStreamType)

Loads text formatted with the specified format. The new text is read from the specified byte array.

public async System.Threading.Tasks.Task LoadTextAsync(byte[] binaryData, Web.BinaryStreamType binaryStreamType);
ParameterDescription
binaryData

Specifies a byte array from which the data is loaded.

binaryStreamType

Specifies one of the BinaryStreamType values.

LoadTextAsync(String, Web.StringStreamType)

Loads text formatted with the specified format. The new text is read from the specified string.

public async System.Threading.Tasks.Task LoadTextAsync(string stringData,  Web.StringStreamType stringStreamType);
ParameterDescription
stringData

Specifies a string from which the data is loaded.

stringStreamType

Specifies one of the StringStreamType values.

Examples

The following example uses TextControl.LoadText in a document-processing workflow.

var result = textControl.LoadText(@"App_Data\document.docx", TXTextControl.Web.StreamType.PlainAnsiText);
Console.WriteLine(result);