TX Text Control .NET Server

LoadDocument 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

Loads a document that is used for further processing.

Syntax

LoadDocument(string)

Loads a document from a specific path.

public void LoadDocument(string path);
ParameterDescription
path

Specifies the document file to be loaded.

LoadDocument(string, FileFormat)

Loads a document from a specific path and a specific document format.

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

Specifies the document file to be loaded.

format

Specifies one of the DocumentServer.FileFormat values.

Examples

DocumentServer.Web.DocumentViewer.LoadDocument 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

If only the path parameter is specified, the file type is determined by the file's extension.