TX Text Control .NET Server

LoadText Method

Method|Introduced in 23.0
Namespace
TXTextControl.Web.MVC
Package
TXTextControl.Web as TXTextControl.Web.DocumentEditor.dll from nuget.org, the private NuGet feed or Text Control Offline Packages

Description

Loads text in a certain format. The complete contents of a TextControl are replaced.

Syntax

LoadText(string, StreamType)

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

public TextControl LoadText(string path, StreamType streamType);
ParameterDescription
path

Specifies a file from which the data is loaded.

streamType

Specifies one of the StreamType values.

LoadText(FileStream, StreamType)

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

public TextControl LoadText(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.

LoadText(byte[], BinaryStreamType)

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

public TextControl LoadText(byte[] binaryData, BinaryStreamType binaryStreamType);
ParameterDescription
binaryData

Specifies a byte array from which the data is loaded.

binaryStreamType

Specifies one of the BinaryStreamType values.

LoadText(string, StringStreamType)

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

public TextControl LoadText(string stringData, StringStreamType stringStreamType);
ParameterDescription
stringData

Specifies a string from which the data is loaded.

stringStreamType

Specifies one of the StringStreamType values.

Return Value

A reference to the Web.MVC.TextControl instance to allow method chaining.

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);