TX Text Control .NET Server

TextControl 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

Creates a TextControl.

Syntax

TextControl()

Creates a TextControl.

public TextControl TextControl();

TextControl(TextControlSettings)

Creates a TextControl using settings from a given TextControlSettings object.

public TextControl TextControl(TextControlSettings settings);
ParameterDescription
settings

A TextControlSettings object containing TextControl extension settings.

TextControl(Action<TextControlSettings>)

Creates a TextControl using settings from a delegate method that accepts TextControlSettings as a parameter.

public TextControl TextControl(Action<TextControlSettings> method);
ParameterDescription
method

A delegate method that accepts TextControlSettings as a parameter.

Return Value

A TextControl object implementing the TextControl functionality.

Examples

The following example shows how to add a TextControl editor to a view, specify its height and width, set a database file directory and open a document with it:

@using TXTextControl.Web.MVC
@using TXTextControl.Web

@Html.TXTextControl().TextControl(settings => {
   settings.Width = "100%";
   settings.Height = "600px";
   settings.DatabaseFileDirectory = Server.MapPath("~/App_Data/Databases");
}).LoadText(Server.MapPath("~/App_Data/Documents/Demo.rtf"), StreamType.RichTextFormat).Render()

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

var result = controlsFactory.TextControl();
Console.WriteLine(result);