TX Text Control .NET Server

Save Method

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

Description

Saves the selected text of a document with the specified format.

Syntax

Save(string, StreamType)

Saves the selected text of a document in the specified file with the specified format.

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

Saves the selected text of a document in the specified file with the specified format.

streamType

Specifies one of the StringStreamType values.

Save(FileStream, StreamType)

Saves the selected text of a document in the specified file stream with the specified format.

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

Specifies a file into which the selection is saved. The data is saved at the stream's current position.

streamType

Specifies one of the StringStreamType values.

Save(out byte[], BinaryStreamType)

Saves the selected text of a document in the specified byte array with the specified format.

public void Save(out byte[] data, BinaryStreamType streamType);
ParameterDescription
data

Specifies a byte array into which the selection is saved. No memory needs to be allocated through the caller.

streamType

Specifies one of the StringStreamType values.

Save(out string, StringStreamType)

Saves the selected text of a document as a string with the specified format.

public void Save(out string stringData, StringStreamType streamType);
ParameterDescription
stringData

Specifies a string into which the selection is saved. No memory needs to be allocated through the caller.

streamType

Specifies one of the StringStreamType values.

Examples

The following example uses Selection.Save in a document-processing workflow.

selection.Save(@"App_Data\document.docx", TXTextControl.Web.StreamType.PlainAnsiText);
Console.WriteLine("Save completed for the Selection workflow.");