TX Text Control .NET Server

Add Method

Method|Introduced in 10.1
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK as TXTextControl.Core.dll from the private NuGet feed or Text Control Offline Packages
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll

Description

Adds to new formatting style to the current document.

Syntax

public bool Add(InlineStyle inlineStyle);

Parameters

ParameterDescription
inlineStyle

Specifies the style to add.

Return Value

The return value is true, if the style could be added. Otherwise it is false.

Examples

The following example works with inline styles in the current document by using InlineStyleCollection.Add.

InlineStyleCollection inlineStyleCollection = textControl.InlineStyles;

if (!inlineStyleCollection.Add(new InlineStyle("CustomerName")))
{
    throw new InvalidOperationException("The item could not be inserted.");
}