TX Text Control .NET Server

Save Method

Method|Introduced in 15.0
Namespace
TXTextControl.DocumentServer.Web
Package
TXTextControl.TextControl.ASP.SDK as TXDocumentServer.Web.DocumentViewer.dll from the private NuGet feed or Text Control Offline Packages

Description

Initiates saving the currently loaded document. The actual saving is performed by a method which has to be bound to the DocumentServer.Web.DocumentViewer.SaveDocument event.

Syntax

Save(FileFormat)

Saves the document in a specific document format.

public void Save(FileFormat format);
ParameterDescription
format

Specifies one of the DocumentServer.FileFormat values.

Save(string)

Saves the document to a specific path.

public void Save(string path);
ParameterDescription
path

Specifies where the document should be saved.

Save(string, FileFormat)

Saves the document to a specific path in a specific document format.

public void Save(string path, FileFormat format);
ParameterDescription
path

Specifies where the document should be saved.

format

Specifies one of the DocumentServer.FileFormat values.

Examples

DocumentServer.Web.DocumentViewer.Save belongs to the legacy Web Forms viewer. In the current ASP.NET Core viewer, configure the server-rendered component through DocumentViewerSettings.DocumentPath; interactive page state and styling are handled by the viewer client.

documentViewerSettings.DocumentPath = @"App_Data\document.docx";
if (!string.IsNullOrWhiteSpace(documentViewerSettings.DocumentPath))
{
    Console.WriteLine($"Document Path: {documentViewerSettings.DocumentPath}");
}

Remarks

A given path is always relating to the server the document viewer is runnig on. Thus, it is good practice to define the path parameter using the HttpServerUtility.MapPath() method.